C++ Memory Usage & Allocation

Started by
11 comments, last by 21st Century Moose 12 years, 1 month ago

//Convert bytes to megabytes
g_uiTotalClusterMemory /= 1024;
g_uiTotalClusterMemory /= 1024;
g_uiTotalCubeMemory /= 1024;
g_uiTotalCubeMemory /= 1024;


Um... you are converting bytes to kilobytes here. To convert to megabytes you need another division by 1024.
Advertisement

[quote name='bullfrog' timestamp='1331105853' post='4920003']
//Convert bytes to megabytes
g_uiTotalClusterMemory /= 1024;
g_uiTotalClusterMemory /= 1024;
g_uiTotalCubeMemory /= 1024;
g_uiTotalCubeMemory /= 1024;


Um... you are converting bytes to kilobytes here. To convert to megabytes you need another division by 1024.
[/quote]

He is dividing by 1024 twice. Just on two separate lines for each value.

<snip>awesome</snip>


This basically. Never work on the basis that the memory you explicitly allocate yourself is the only memory used by your program, because it's not. Any API call you make, or any call into any external library, will very probably be doing it's own memory allocations, as well as fixed overhead from bringing up the program under the OS (heap space, stack space, program loader, all kinds of mysterious gubbins). None of this is under your control - it's like being a guest in somebody's house and finding that the fridge is empty. You've only been eating a small amount so far asyou know, certainly not enough to empty the fridge, but your hosts have also been eating.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement