As we near beta of our first title, I'm more concerned about details such as memory usage.
I don't believe the data structures waste much memory, but I am concerned about some large GapiDraw surfaces.
How can I best measure the memory used by my game once it has read in its data, and while it is running?
This memory comes from "program memory" in the memory control panel, right?
Do you have it working on the desktop as well?
If you do you can get a rough estimate by opening the task manager in Win2K or WinXP and see how much memory its process is using. It'll vary on the PPC I'm sure, but probably not by too much.
-John
there is fast way to do this on the device, but it's only an approximation:
overload the operator new, new[], delete and delete[]. And in those functions, add a memory counter that add/sub nb of bytes. If all the memory is allocated at the start of the program, it will be almost accurate, but if there is a lot of dynamic allocation, because of the fragmentation, it won't be really precise. But at least, you will have a better idea.
Having a memory manager is interesting for this matter :P but it's a lot of works.
Another way, is the brute force :P Full the memory of the ppc until your app don't works.
angedelamort wrote:Another way, is the brute force :P Full the memory of the ppc until your app don't works.
That sounds like a good approach for my purposes. But that gets back to one of my original questions: where does the memory come from? What am I filling up to see where my app runs out of memory? Is it the "free program memory" in the memory control panel?
Is there no equivalent to the task manager for Pocket PC 2002?
don't forget that the ppc share the same memory for the ram and storage. So, a good way to do this is to write a small app that dump data in file size you want.
%dump.exe 1024
and after that you upload the data on the device and run yopur app. it everything works fine, upload more, and with the memory manager of the ppc, you will be able to see how much left memory that make your program crash.
before having a mem manager, I was doing that. It works fine.
mlepage, the OS will adjust the amount of Program Memory vs. Storage Memory dyanmically, so asking where it comes from is kind of a loaded question. I suppose the real answer is it's all the same memory pool, so either Program Memory or Storage Memory (or both) could decrease as your app runs. It's supposed to take Program Memory first of course and then take from Storage Memory, but I've seen it do wacky things sometimes.
I've always followed the brute-force approach myself, although I have a slightly easier way to do it... simply create a 1MB file on your desktop (I usually just create a suitably large bitmap file with no compression) and copy it to your device. Then, lay on the cough and copy that file a number of times, progressively reducing the amount of memory available, and try and run your game.
I'd actually like opinions on how accurate the suggestion of just looking at task managers on the PC is... If so, it's a very eye-opening thing because I've been extremely careful about memory usage in my current game but it's between 6MB and 8MB throughout it's run on the desktop. That's not all that bad considering what's in the game, but it's still considerably higher than my goal. Can anyone expand on whether that's an accurate measure or not?
why not simply use the device monitoring tools that come with eVC to find out how much memory the application is using?
just an idea...
Daniel
fzammetti wrote:
I'd actually like opinions on how accurate the suggestion of just looking at task managers on the PC is... If so, it's a very eye-opening thing because I've been extremely careful about memory usage in my current game but it's between 6MB and 8MB throughout it's run on the desktop. That's not all that bad considering what's in the game, but it's still considerably higher than my goal. Can anyone expand on whether that's an accurate measure or not?
I'm pretty sure you need to look at the Virtual Memory Size column. It's not displayed by default so you have to turn it on.
I also do some sanity checks by using sizeof and going through all the classes and loaded surfaces etc. Usually doing that I realize something like I still have the Intro screen image loaded and I can free that memory.
Pam
drgoldie wrote:why not simply use the device monitoring tools that come with eVC to find out how much memory the application is using?
just an idea...
Daniel
Would that require a debug build, or can you do it with a release build?
Unfortunately, I am unable to connect to my device via eVC3 to debug on the device. I posted about it here before but nobody could help me fix it. When I test the connection, it says it is fine, but it won't actually connect to download the program to the device or debug it on the device.