-1

Hi I'm developing a 3D Application and loading in all images / models in on a loading screen, however now I'm getting to the point of running out of RAM and I still need to put more models in the application.

Any advice to what I can do keep in mind I still need the application to be fast when selecting a model to add to a scene (hence the reason why I pre-load images / models)

Images are in dxt format so they are already compressed.

I am using VirtualAlloc to allocate the memory and VirtualFree to free the memory (as necessary).

Any advice is greatly appreciated.

Jenzien
  • 23
  • 3
  • By the sounds of it, you need to reduce the amount of models you need per level.. and then only load them by level.. – BugFinder Mar 19 '16 at 14:50

1 Answers1

-2

Well, get more memory.

Seriously. Run out? Limit on a modern desktop is 64gb ;)

Managing memory is a challenge. You have only 2 choices: Loading on demand (which you reject) and dealing with it by providing enough memory.

The only way you are really limited is if you write a 32 bit program (due to the hard limit of 3gb memory, out of which in .NET you have a problem going over 2gb practically).

TomTom
  • 61,059
  • 10
  • 88
  • 148
  • 1
    This isn't accurate. You can also run out of memory by memory fragmentation. The good news is that if you use .NET 4.5.1, you can compact the Large Object Heap (http://stackoverflow.com/a/27738768/16587). You'll see quite a bit of stutter when that happens; but it'll keep you from running out. – George Stocker Mar 19 '16 at 14:15
  • ^^Thanks this has helped out a little bit – Jenzien Mar 19 '16 at 14:56
  • Just so you know, this answer has received 3 "looks ok" and 3 "Recommend deletions" in the [Low quality review](https://stackoverflow.com/review/low-quality-posts/11703113) – Ferrybig Mar 20 '16 at 18:38