Reputation: 88
I have quite a bothersome memory issue. I'm using the package called Memory Profiler to help me try and identify the problem, but I'm not sure if I understand it properly. Basically I'm loading a map at runtime from a file, and when I load it in my actual build I get a memory snap file of around 1.2 GB in size from the Memory Profiler. But when I load the same map in a new empty project using the same code, the snap file is around 230 MB. I checked to see if the extra memory is from other stuff in the project, but if I do a memory snap before loading the map, the snap file is only 90 MB large. From what I can see in the memory map view, it looks like the extra amount is unused space I think between objects (I'm not sure, I don't know the terms very well). So my question is, if this is the case, how can I avoid this from happening. This wouldn't be an issue, but loading larger maps cause a crash.
For some reference, here are some images of the memory profiler snaps:
Upvotes: 1
Views: 1601
Reputation: 1637
Every engine pre-allocates memory for it's internal use. And yet this says nothing about cause of your particular crash.
Most memory-related crashes aren't caused by usual operations you can pick up with this memory allocation and fragmentation view.
What you need to do instead is to pin down the moment the crash happens and read it's stack trace for details. Because it may be the case that, for example, your problem is caused by your own code (I would bet on that) that is loading assets in some kind of loop without ever releasing that memory.
Upvotes: 1