• Advertisement
Sign in to follow this  

Memory problem

This topic is 4251 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I need to reduce the memory usage of an application. Its breaks the 2GB limit set by the memory manager of win2k pro. I was wondering if reducing "private bytes" would help or if only "virtual bytes" matters.

Share this post


Link to post
Share on other sites
Advertisement
I don't know what language "private" and "virtual" bytes are from, and what exactly of your application is taking up so much, but some helpful things I can think off:

use 8-bit or 16-bit instead of 32-bit or 64-bit integers where possible
don't make unnecessary copies of data, like textures
don't load everything at once if it's not necessary

Share this post


Link to post
Share on other sites
It comes from performance monitor (exec -> perfmon).

Share this post


Link to post
Share on other sites
It seems you have a resource or memory leak there - or just some huge data set.
It's impossible to tell or to give any concrete advise without further information on the data, the functionality and the overall program flow.

Is the memory usage increasing over time? If so, the reason could be a memory or resource leak.

Is the processed data set big? If so, find a way to stream the data as it is needed/processed instead of holding it in memory all the time. You can also use memory mapped files to improve streaming data access in this case.

Good luck and tell us more,
Pat.






Share this post


Link to post
Share on other sites
Its hard to tell you more because its for a corp.

Basically the app is a flight sim, the space comes from loading world tiles from databases. It has been profiled many times for leaks so I doubt its something major. It just uses that much space.

When I rebase the DLLs I gain 15megs of private bytes. I'm not sure if the limit is on the virtual bytes only.

Share this post


Link to post
Share on other sites
Quote:
Original post by Yalpe
Its hard to tell you more because its for a corp.

Basically the app is a flight sim, the space comes from loading world tiles from databases. It has been profiled many times for leaks so I doubt its something major. It just uses that much space.

When I rebase the DLLs I gain 15megs of private bytes. I'm not sure if the limit is on the virtual bytes only.


I think you're loading waaaaaay to much at once to take up 2GB.

Don't load so much at once. Whatever is not being used should not be in system memory. I think you're loading everything at once, even whatever is not being used all the time.

Share this post


Link to post
Share on other sites
Quote:
Original post by Yalpe
Its hard to tell you more because its for a corp.

Basically the app is a flight sim, the space comes from loading world tiles from databases. It has been profiled many times for leaks so I doubt its something major. It just uses that much space.

OK. So you have a huge data set - that's all I needed to know [smile]. Streaming the input data instead of loading it all at once is a solution then.
This will be difficult to do if you need all the data or a very large portion of it at once (i.e. flying high and a huge section of the map is visible).

However, you will not need all detail of the data at once. This means that at high altitudes, a different tileset or whatever is used that is less detailed.
You can seamlessly blend into higher detailed data sets on the fly by determining the best Level-Of-Detail [LOD] (which is kind of what I'm trying to explain here [smile]) by using some heuristic like the current altitude and viewing angle.

Without applying a combination of such techniques ([dynamic] LOD + streaming), you won't be able to decrease memory consumption without sacrificing a lot of visual quality and accuracy.

HTH,
Pat.

EDIT: If you already use LOD and streaming, try to add some on-the-fly compression as well...

Share this post


Link to post
Share on other sites
Whatever the technique I employ. I was wondering if I saved "Private Bytes" if it would prevent me from breaking the 2GB limit, or is it limited to "Virtual Bytes".

Share this post


Link to post
Share on other sites
Quote:
Original post by Yalpe
Whatever the technique I employ. I was wondering if I saved "Private Bytes" if it would prevent me from breaking the 2GB limit, or is it limited to "Virtual Bytes".
Don't worry about which. Reducing how much memory you use will generally reduce both.
Rebasing your dlls is always a good idea so do that anyway.
Please work out from your code and tell us, what the occupies the most memory in your program. e.g. textures, heightmap, sound, video...

e.g. If it's a heightmap, then you can use custom compressed 16-bit floats, or 16-bit fixed point. Just ask if you want a 16-bit float class btw.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement