Open SeanTAllen opened 2 years ago
@jemc is going to add a write-up of the agreed upon (by he and I) solution.
@jemc did you ever do a write up? i don't remember our agreed upon solution.
Note that the fix for #1118 as seen in https://github.com/ponylang/ponyc/pull/4247 fixes this leak.
A full "non hack" fix for #1118 might not fix this leak.
Yes, I suspect that as we iteratively bring back the optimization removed in #4247 this memory leak will likely come back as well - I think it likely still needs a separate fix.
In fact, the minimal example in the ticket description should come back in the very first iteration of bringing back the optimization, as Array[U8]
very obviously cannot contain an actor.
The following program will leak memory, but can be switched to not leak memory as noted in the comments:
It should be noted that the "doesnt leak memory version" takes a while to reach "memory equilibrium" so it memory growth slowly occurs. The test program will rapidly leak memory with the "bad" version and you should see over a gig in memory used within a minute of running whereas the "good" version will have significantly less usage (it will stabilize at less than 100 megs within a few minutes).
The issue stems from the call going through a trait that is
iso
and traced as such and the receiving end being aval
and then we don't do the correct tracing and objects end up not being freed.In Zulip @jemc stated:
Full zulip thread is at: https://ponylang.zulipchat.com/#narrow/stream/189985-beginner-help/topic/Debugging.20excessive.20memory.20usage