Closed t-persson closed 7 years ago
Thanks for the report, I'll look into it.
On Sat, Apr 29, 2017 at 6:53 AM Tobias Persson notifications@github.com wrote:
Inside the pygame AbstractGroup there is a list which stores all removed sprites. This list is cleared in the "draw" call of the pygame Group.
However, inside the PyscrollGroup which inherits and overrides the "draw" method, this list is never cleared. This will cause problems if you add and remove sprites to the group, as memory usage will constantly increase.
Attached zip file has a program (python3) which will reproduce the problem. In the file added we redraw a sprite every iteration of the main loop and it will print the time it takes to clear sprites every 5s. This is of course a worst case scenario, but if you're utilizing the PyscrollGroup for a long time, then I can see the program running slower and slower as the list increases.
reproduce.zip https://github.com/bitcraft/pyscroll/files/966109/reproduce.zip
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bitcraft/pyscroll/issues/23, or mute the thread https://github.com/notifications/unsubscribe-auth/AAh-p2MPmYPvxUODAaguith-mcUbfze1ks5r0ySrgaJpZM4NMO2u .
Added a pull request which fixes it
Inside the pygame AbstractGroup there is a list which stores all removed sprites. This list is cleared in the "draw" call of the pygame Group.
However, inside the PyscrollGroup which inherits and overrides the "draw" method, this list is never cleared. This will cause problems if you add and remove sprites to the group, as memory usage will constantly increase.
Attached zip file has a program (python3) which will reproduce the problem. In the file added we redraw a sprite every iteration of the main loop and it will print the time it takes to clear sprites every 5s. This is of course a worst case scenario, but if you're utilizing the PyscrollGroup for a long time, then I can see the program running slower and slower as the list increases.
reproduce.zip