Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Fix some memory leaks in RCM #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions reordering/ConnectedComponents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ void findConnectedComponents_(

delete[] rootToComp;
if (nodesToFind) delete[] nodesToFind;

delete[] p;
}

void findConnectedComponents(
Expand Down
7 changes: 6 additions & 1 deletion reordering/RCM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ void CSR::getRCMPermutation(int *perm, int *inversePerm, bool pseudoDiameterSour

int numOfComponents;
int *compToRoot, *compSizes, *compSizePrefixSum;
int *nodesSortedByComp;
int *nodesSortedByComp=NULL;

double timeConnectedComponents = -omp_get_wtime();
findConnectedComponents(
Expand Down Expand Up @@ -945,6 +945,11 @@ void CSR::getRCMPermutation(int *perm, int *inversePerm, bool pseudoDiameterSour
delete[] write_offset;
delete[] prefixSum_array;

if(nodesSortedByComp)
{
delete[] nodesSortedByComp;
}

#if 0
printf("num of connected components = %d (singleton = %d, twin = %d, large (>=%d) = %d)\n", numOfComponents, singletonCnt, twinCnt, PAR_THR, largeCompCnt);
printf("connectedComponentTime = %f\n", timeConnectedComponents);
Expand Down