Fix leak in write_nrnthread.#2456
Conversation
|
✔️ cd3c5fb -> Azure artifacts URL |
Codecov Report
@@ Coverage Diff @@
## master #2456 +/- ##
=======================================
Coverage 60.41% 60.42%
=======================================
Files 626 626
Lines 120812 120799 -13
=======================================
+ Hits 72990 72992 +2
+ Misses 47822 47807 -15
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
This comment has been minimized.
This comment has been minimized.
cd3c5fb to
0e7d4a2
Compare
|
✔️ 0e7d4a2 -> Azure artifacts URL |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
✔️ 932cd32 -> Azure artifacts URL |
|
Just to provide some more explicit explanation, before #2027 we had this logic: nrn/src/nrniv/nrncore_write/callbacks/nrncore_callbacks.cpp Lines 354 to 360 in b4ade55 where contiguous_art_data allocated new storage that needed to be freed later:nrn/src/nrniv/nrncore_write/io/nrncore_io.cpp Lines 317 to 326 in efc28fe whereas in master we treat artificial and non-artificial cells uniformly:nrn/src/nrniv/nrncore_write/callbacks/nrncore_callbacks.cpp Lines 354 to 359 in efc28fe |
Running a memory profiler on simulations using neurodamus to create the input files for coreneuron in multiple cycles showed that memory allocated in:
nrn/src/nrniv/nrncore_write/callbacks/nrncore_callbacks.cpp
Line 358 in 5ea534f
accumulated across cycles. The function is called from
write_nrnthread, with the following context:looking into
nrnthread_dat2_mechwe find the following structure:In summary when called from
write_nrnthread:datapassed tonrnthread_dat2_mechis unconditionallyNULL.dataunconditionally.nrn_is_artificial_[type]which seems to only sometimes hold.The immediate fix is to simply release the memory since it doesn't seem to be used afterwards. Profiling the same run shows the expected reduced memory consumption.