lingua-franca icon indicating copy to clipboard operation
lingua-franca copied to clipboard

Fix memory leak in unfederated execution

Open jackyk02 opened this issue 1 year ago • 2 comments

Similar to the memory leak issue in federated execution, the reference counts for some PyObjects are not being appropriately managed. In the case for unfederated execution, when the reaction that takes an input and schedules an action with the value of that input, it increases the reference count of self->_lf_inp->value, which is unnecessary.

Initialization: Untitled1

After execution for 20 rounds, the memory usage increased to 10GBs: Untitled2

jackyk02 avatar Oct 21 '23 05:10 jackyk02

The segfault with src/DelayArrayWithAfter.lf indicates that the leak is because of a failure to decrement the reference count at the right point rather than an extra increment of the reference count. Perhaps the reference count for the value needs to be decremented in generateForwardBody?

edwardalee avatar Oct 21 '23 16:10 edwardalee

Could this be related to #2082?

lhstrh avatar Nov 03 '23 21:11 lhstrh