C++ / Win32 and Mem. Usage
I just wrote my first semi OOP Win32 Window Wrapper, but I'm a little concerned about it's memory usage. At present it's using an average of 3.84 mb of system memory according to the Task Manager, is this normal or should I consider making a few optimizations to my code? The project I have in mind for the summer could clock up a lot more memory usage as I progress, so I'd prefer not to have a framework thats to memory intensive. Any advice would be greatly appreciated on this!
Thanks,
Ad!
How much memory is used when you create a window with an equivalent amount of functionality, without using your wrapper, but instead by just using plain ol' C Win32 programming? My guess is that it'll use just about the same amount anyway. The memory usage is probably coming from Windows, not from your wrapper. Just a guess, though.
If you use Visual Studio, try and turn of debug mode. That probably removes a significant amount of that memory.
Oh right, well If i strip out the classes and use C instead, it does around 3mb. I would have thought this is till quite high for whats actually going on?
Check what .lib files you include into your project. visual studio loads a whole bunch by default.
Task manager doesn't show you memory usage, it shows you working set size, which is an approximation of memory usage. Think of it as the number of virtual memory pages that the process 'touched,' as anything can count against it, including (but not limited to) I/O handles, DLLs loaded on the fly by the system, and of course explicit memory allocations. For a newly launched process 3MB is fine, you can get a truer idea of the real memory usage by minimizing and restoring the window.
As for removing libs, don't. The linker in release mode removes unnecessary dependencies.
Also, how much RAM do you have? Windows is more generous with its memory allocations if you have lots of free RAM. After all, there's no use just letting it go to waste. It is hilarious that the "power users," the ones with 1GB of memory, are the ones that are the first to bitch about an app using up 4MB of memory when the app doesn't even have much control over it. See also the ambigious definition of 'bloat.'
As for removing libs, don't. The linker in release mode removes unnecessary dependencies.
Also, how much RAM do you have? Windows is more generous with its memory allocations if you have lots of free RAM. After all, there's no use just letting it go to waste. It is hilarious that the "power users," the ones with 1GB of memory, are the ones that are the first to bitch about an app using up 4MB of memory when the app doesn't even have much control over it. See also the ambigious definition of 'bloat.'
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement