src/graph/graphcontext.c
// Free all data associated with graph
Free all data associated with graph
Free all data associated with graph
static void _GraphContext_Free(void *arg) {
	GraphContext *gc = (GraphContext *)arg;
	uint len;
	Graph_SetMatrixPolicy(gc->g, DISABLED);
	Graph_Free(gc->g);
	if(gc->node_schemas) {
		len = array_len(gc->node_schemas);
		for(uint32_t i = 0; i < len; i ++) {
			Schema_Free(gc->node_schemas[i]);
		}
		array_free(gc->node_schemas);
	}
	if(gc->relation_schemas) {
		len = array_len(gc->relation_schemas);
		for(uint32_t i = 0; i < len; i ++) {
			Schema_Free(gc->relation_schemas[i]);
		}
		array_free(gc->relation_schemas);
	}
	if(gc->attributes) raxFree(gc->attributes);
	if(gc->string_mapping) {
		len = array_len(gc->string_mapping);
		for(uint32_t i = 0; i < len; i ++) {
			rm_free(gc->string_mapping[i]);
		}
		array_free(gc->string_mapping);
	}
	assert(pthread_rwlock_destroy(&gc->_attribute_rwlock) == 0);
	if(gc->slowlog) SlowLog_Free(gc->slowlog);
	if(gc->cache_pool) {
		len = array_len(gc->cache_pool);
		for(uint i = 0; i < len; i++) Cache_Free(gc->cache_pool[i]);
		array_free(gc->cache_pool);
	}
	GraphEncodeContext_Free(gc->encoding_context);
	GraphDecodeContext_Free(gc->decoding_context);
	rm_free(gc->graph_name);
	rm_free(gc);
}
static void _GraphContext_Free ( void * arg ) { GraphContext * gc = ( GraphContext * ) arg ; uint len ; Graph_SetMatrixPolicy ( gc -> g , DISABLED ) ; Graph_Free ( gc -> g ) ; if ( gc -> node_schemas ) { len = array_len ( gc -> node_schemas ) ; for ( uint32_t i = 0 ; i < len ; i ++ ) { Schema_Free ( gc -> node_schemas [ i ] ) ; } array_free ( gc -> node_schemas ) ; } if ( gc -> relation_schemas ) { len = array_len ( gc -> relation_schemas ) ; for ( uint32_t i = 0 ; i < len ; i ++ ) { Schema_Free ( gc -> relation_schemas [ i ] ) ; } array_free ( gc -> relation_schemas ) ; } if ( gc -> attributes ) raxFree ( gc -> attributes ) ; if ( gc -> string_mapping ) { len = array_len ( gc -> string_mapping ) ; for ( uint32_t i = 0 ; i < len ; i ++ ) { rm_free ( gc -> string_mapping [ i ] ) ; } array_free ( gc -> string_mapping ) ; } assert ( pthread_rwlock_destroy ( & gc -> _attribute_rwlock ) == 0 ) ; if ( gc -> slowlog ) SlowLog_Free ( gc -> slowlog ) ; if ( gc -> cache_pool ) { len = array_len ( gc -> cache_pool ) ; for ( uint i = 0 ; i < len ; i ++ ) Cache_Free ( gc -> cache_pool [ i ] ) ; array_free ( gc -> cache_pool ) ; } GraphEncodeContext_Free ( gc -> encoding_context ) ; GraphDecodeContext_Free ( gc -> decoding_context ) ; rm_free ( gc -> graph_name ) ; rm_free ( gc ) ; }
Free all data associated with graph
Free all data associated with graph
// Disable matrix synchronization for graph deletion. // Free all node schemas // Free all relation schemas // Free attribute mappings // Clear cache