Closed finbarrtimbers closed 2 years ago
Thanks for the report! I'll look into this and see if I can find the memory leak.
I think your current workflow is fine for episodic experiments. JBW was designed specifically for the never-ending/continual setting so we didn't do much testing for episodic use-cases.
That makes sense. This would be difficult to find in the continual setting, as as it's only 12MiB.
I just pushed a commit that fixes one memory leak. It was a subtle bug where we were creating a cyclic reference where C++ would reference the callback functions in the Simulator object, and the callbacks and Simulator object reference each other. So the Simulator object would never be garbage collected, even if there were no references to it from Python.
You might need to force garbage collection after each episode if you want to make sure that memory usage stays constant, otherwise it seems to garbage collect every ~10 episodes in my tests.
Let me know if this change fixes the issue in your setup.
Fantastic- thank you for the quick fix. I will test that out.
On Thu, Apr 7, 2022 at 5:02 PM Abulhair Saparov @.***> wrote:
Let me know if this change fixes the issue in your setup.
— Reply to this email directly, view it on GitHub https://github.com/eaplatanios/jelly-bean-world/issues/12#issuecomment-1092285416, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYN6RMA2QPHH5O6IO3ONZ3VD5SPBANCNFSM5SWYAEIQ . You are receiving this because you authored the thread.Message ID: @.***>
-- Finbarr
Hi, I think with the updated simulator.py and simulator.cpp, the "jbw-v1" environment is not returning correct reward value. Can you please double check this?
Oh weird. Thanks for letting me know. I'll look into it.
@sophistz I found an bug that I had created in fixing the memory leak. 😅 I just pushed some changes that will hopefully fix it.
@asaparov Thanks. The code works now!
Memory leak appears to have been fixed- thanks for the quick patch!
Hey folks!
I'm running an episodic version of JBW in Python for some experiments. Basically, we create a
Simulator
object fromapi/python/src/jbw/simulator.py
, run it forN
frames, then delete it and create a newSimulator
. When I do this, I see memory increase by ~12MiB for each call tosimulator_c.new
. I'm wondering if something isn't beingfree
'd properly insimulator_c.delete
.I have two questions:
1) Have you run into this before? Do you have any idea what could be causing this? 2) Is there a better way to run this episodic experiment?