godot
godot copied to clipboard
Memory leak when running a barebones project from editor
Godot version
v4.1.dev (c1128e911ccd6f1e8)
System information
macOS Monterey, version 12.4
Issue description
Hello,
When I create a very simple barebones project with only a Node3D, and run it via the editor, I noticed the memory usage trends up over time even though nothing is happening in the game. I guess this is a memory leak? If not what is the explanation? Thanks
edit: Could it be because Godot doesn't clean up memory right away and the garbage collection happens at a later time?
Steps to reproduce
Create a new project and add a Node3D. Observe the memory usage slowly go up over time.
Minimal reproduction project
I'm running it on my macbook M1, and its 1GB with no change over time.
What macbook are you using?
Also, why you have 2 processes with godot editor?
It should be 1
Can you post before and after images that show that the editor increases memory usage?
Also, what are you doing in the editor itself? If you are doing nothing, the memory usage is the same.
I had exactly the same memory problem with Godot 4.0stable on a "Mac Mini Intel 2018" with macOS Ventura 13.2.1, 16GB RAM.
For me it happened when importing an old 3.5.1 project (which was empty). Opening the old empty project and then leaving the window open takes about >85% CPU time....and then the memory leak grows and grows everything 2-3 seconds, the app becomes unresponsive and had to cancel quit Godot 4.0stable.
Creating a new project or importing an old project with some scripts etc. seems to work for now...no mem leaks.
@gilcel Unfortunatly I don't have this hardware and I can't replicate it :(
I have a MacBook Pro (14-inch, 2021)
I think most likely after talking to others it's not a leak, but the way the OS manages memory. Freed data probably isn't wiped out immediately but during pages or such. I am not an expert here. Curious what others have to say though. If it's determined to not be a real issue then feel free to close the ticket.
On Fri, Mar 10, 2023 at 6:18 AM Shlomi @.***> wrote:
Unfortunatly I don't have this hardware and I can't replicate it :(
— Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/74698#issuecomment-1463657760, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARL6JW3TWSZR62XVQLAR3F3W3MEXHANCNFSM6AAAAAAVV4FM54 . You are receiving this because you authored the thread.Message ID: @.***>
I'm running it on my macbook M1, and its 1GB with no change over time. What macbook are you using? Also, why you have 2 processes with godot editor? It should be 1
Can you post before and after images that show that the editor increases memory usage? Also, what are you doing in the editor itself? If you are doing nothing, the memory usage is the same.
Did you start the game? The editor process does not increase over time, but the game process does. When you start the game there are 2 processes called godot.
Here are 3 screenshots in sequence:
11:30 AM

11:31 AM
11:32 AM
Testing on macbook air m1, running the game of the project that you uploaded this issue (memtesting.zip)
Before:
After 5 minutes:
Commit im on: c1128e911ccd6f1e8c35646df804d894652a58f1
Maybe try to run profiler in godot to see if it indeed uses more CPU/memory. Not sure, can't replicate. Or check activity monitor statistics on this process
I did some other testing and it seems like a non-issue. When I free a lot of objects (in a more complicated setup than the example) the memory goes back down. I'm going to close this issue.