MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / _Graph_Free

Function _Graph_Free

src/graph/graph.c:1361–1412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1359}
1360
1361static void _Graph_Free
1362(
1363 Graph *g,
1364 bool is_full_graph
1365) {
1366 ASSERT(g);
1367 // free matrices
1368 AttributeSet *set;
1369 DataBlockIterator *it;
1370
1371 RG_Matrix_free(&g->_zero_matrix);
1372 RG_Matrix_free(&g->adjacency_matrix);
1373
1374 _Graph_FreeRelationMatrices(g);
1375 array_free(g->relations);
1376 GraphStatistics_FreeInternals(&g->stats);
1377
1378 uint32_t labelCount = array_len(g->labels);
1379 for(int i = 0; i < labelCount; i++) RG_Matrix_free(&g->labels[i]);
1380 array_free(g->labels);
1381 RG_Matrix_free(&g->node_labels);
1382
1383 it = is_full_graph ? Graph_ScanNodes(g) : DataBlock_FullScan(g->nodes);
1384 while((set = (AttributeSet *)DataBlockIterator_Next(it, NULL)) != NULL) {
1385 if(*set != NULL) {
1386 AttributeSet_Free(set);
1387 }
1388 }
1389 DataBlockIterator_Free(it);
1390
1391 it = is_full_graph ? Graph_ScanEdges(g) : DataBlock_FullScan(g->edges);
1392 while((set = DataBlockIterator_Next(it, NULL)) != NULL) {
1393 if(*set != NULL) {
1394 AttributeSet_Free(set);
1395 }
1396 }
1397 DataBlockIterator_Free(it);
1398
1399
1400 // free blocks
1401 DataBlock_Free(g->nodes);
1402 DataBlock_Free(g->edges);
1403
1404 int res;
1405 UNUSED(res);
1406
1407 if(g->_writelocked) Graph_ReleaseLock(g);
1408 res = pthread_rwlock_destroy(&g->_rwlock);
1409 ASSERT(res == 0);
1410
1411 rm_free(g);
1412}
1413
1414void Graph_Free
1415(

Callers 2

Graph_FreeFunction · 0.85
Graph_PartialFreeFunction · 0.85

Calls 14

RG_Matrix_freeFunction · 0.85
array_freeFunction · 0.85
array_lenFunction · 0.85
Graph_ScanNodesFunction · 0.85
DataBlock_FullScanFunction · 0.85
DataBlockIterator_NextFunction · 0.85
AttributeSet_FreeFunction · 0.85
DataBlockIterator_FreeFunction · 0.85
Graph_ScanEdgesFunction · 0.85
DataBlock_FreeFunction · 0.85

Tested by

no test coverage detected