Conversation
Co-authored-by: rbroderi <15883611+rbroderi@users.noreply.github.com>
Co-authored-by: rbroderi <15883611+rbroderi@users.noreply.github.com>
|
Thanks. So, from what I understand, the issue is that Lua's garbage collection (in Lua 5.5) can take its time to free unused userdata entries after Lupa marked them as released, and Lupa might end up reusing the slot before it's actually freed. You resolve that with a freelist that keeps all userdata alive and never frees it, and instead does its own reuse management. Right? That doesn't seem a bad idea, and it might even have a positive effect on allocation speed. But it does have the downside of keeping all userdata alive, which can become a visible memory leak when memory usage (or, rather, the live object count) changes largely over time. I think I found a simpler fix in #296 Please test it on your side. I tried to take care that it doesn't introduce memory leaks but I'm not entirely sure that I succeeded. |
|
Thanks for the quick look at this. I will check it out. And yes your fix does seem simpler. |
A possible fix for #294 I won't claim to be an amazing c programmer but this fix seems to be where the problem is. I would suggest reviewing this as it was AI assisted. It would be at least a good start as to a fix for #294.