Open soyrandom1 opened 4 years ago
Can you reproduce this in the newest release candidate?
Can you reproduce this in the newest release candidate?
i'll try and also i'll include an example file as soon i have some time, maybe tonight
Tested in Godot 3.2.2.stable on linux mint 18 with this test project: 35468.zip
Steps to try:
Godot editor gains maybe a megabyte or two every one or two repeats. Doing it without making collision siblings (eg. load scene, toggle sprite visibility, reload scene, repeat) shows no apparent gain (when viewing size in megabytes to 1DP).
So, memory used for collision shapes (or generating them) does seem to hang around (but of course that could just be leftover pool or something rather than leak). Godot reports no leaks/orphans/etc. in terminal on exit (running with --verbose).
Godot does get laggy when you have complex/many collisions shapes, as you'd expect (lag in the game is interesting though - when moving, it can move fairly smoothly (depending on amount of collision of course), but when you release all keys then press one to move it pauses for about half a second). Things go back to normal speed in both editor and game once collisions are deleted or the scene is reloaded.
Problem in practice? Well for me, lag grows to unworkable levels long before godot could leak enough memory to be an issue, so... I guess if you're working in a single editor instance for weeks and are doing these operations a lot?
(Note: included project also includes a Node2D with a toggle in the inspector to print stray nodes. You can see the list grow if you make, delete, re-make collision siblings over and over - but it returns to normal when you load the scene afresh. I think that's expected.)
(Curiosity: it takes about two seconds to generate collisions, but minutes to delete them :no_mouth: reload scene is still fast though)
Godot version: 3.1.2 stable win64
OS/device including version: Windows 10
Issue description: I was playing arroun with the "create CollisionPolygon" sprite tool. I generated one with lots of points, so godot and my game got very laggy. (I did some tests before with more simplification and my program worked fine). Then i went back to the more simplified version of that collisionPolygon but when running my game it was very slow. The game was using arround 500mb of memory. I was super lost, because it worked fine and now it was laggy. I restarted my pc and the game went back to normal (arround 25/30mb of memory usage), so i'm pretty sure this is a memory leak.
Steps to reproduce: from an sprite, use the "Create CollisionPolygon" (i have the spanish version, it says something like "create brother of (or for) collisionPolygon2D", i'm not sure about the exact name in english); then at simplification use the default value (2). Attach some movement code to that sprite so you can see if it lags. (spoiler alert, it doesn't). Now generate that collisionPolygon again but at simplification use some ridiculous value like 0.3, run the game, it's going to be laggy (if not, use a lower value). Then generate it again with the first value (2), run the game and you will see it lags a lot.
Minimal reproduction project: I really don't have time to do a demo file rn, sorry!