All,
I'm running my game code on pyglet 1.1.4, and am seeing what looks to
me like a memory leak. That is, while the code is executing the RSS
continually increases until eventually my laptop starts swapping and
eventually the code exits with a bus error.
I investigated with guppy: I did a heap dump once at startup, once
after the first slowdown due to running out of memory and hitting
swap, then once this is detected I exited pyglet and did one last heap
dump. I noticed that all three dumps showed approximately the same
heap size (approximately 18 MB), even though htop shows the code is
using gigabytes of memory.
From what I've read, these heap dumps only show python memory usage,
which means the rest of the memory would be occupied by C code. If my
understanding is correct, this would seem to indicate a memory leak in
the ctypes that pyglet is generating. My understanding of the
underlying code is hazy, so please feel free to correct any incorrect
terminology I may be using or any other errors in my understanding/
description.
Here was the Apple crash report when I encountered the bus error:
https://gist.github.com/1612500
Here is the code that contains the memory problem:
https://github.com/greenmoss/NotOrion/tarball/bus_error
I created a utility to automatically trigger the condition. To run it,
download/untar the above tarball, then cd to the "demo" directory,
then execute "./label_move.py". If you allow this utility to run
continually, it should replicate the behavior described above. If you
have a lot of free memory, it may take a while to use it all before it
hits swap.
Does anyone have any suggestions for getting past this problem?