FERNmatrix / Thermo-nuclear-network

1 stars 5 forks source link

Memory leak in compareGSLvectors causes crash #21

Closed jayjaybillings closed 2 years ago

jayjaybillings commented 2 years ago

Line 2282 repeatedly allocates over *rv2minus and causes a memory leak due to a dangling pointer. Running the 365 isotope network crashes on my machine at 16.4gb of memory used.

One way to fix this is to call free() immediately after the comparison. Another and better way is to create the comparison vector rv2minus as a global vector that is only allocated at start and always freed at the end. I've opted for the former in my PR for this so as to disturb the overall functionality as little as possible.

jayjaybillings commented 2 years ago

@guidrymwg to verify