API code to check system RAM and available mem
BlitzMax Forums/BlitzMax Programming/API code to check system RAM and available mem
| ||
Hiya, anyone got any neat win32 and OSX calls to determine the amount of RAM on the system (and possibly the free RAM too)? That would be really great! I've also love to know how to detect video RAM but I gather that functions that do this are unreliable (well their return result is). Shame... |
| ||
I believe the DXDriver uses DX System support texture management with an LRU algo. This means it must be obtaining available and free VRAM somehow.This is probably using GetAvailableVidMem for both available and free videmem. There is also GetAvailableTotalMem and GetAvailableFreeMem. <edit> However, this is probably the same DX commands B3D used and there was a suggestion of erroneous results. |
| ||
I thought max had some kind of memory availability thing? As for video ram you won't get OpenGL to tell you the mem it uses because it's designed to be *cross platform* and able to run on a whole host of architectures so there is no single scheme it can use to globally provide memory usage. Or at least that's what they claim. You can approximately calculate it based on counting texture sizes, data formats, framebuffer format/size, mipmap levels, etc... but it isn't just limited to those things. |
| ||
Don't know anything about OSX but in Windows you can use GlobalMemoryStatusEx or GlobalMemoryStatus. |
| ||
OK thanks. I'll see if someone has declared those with the correct params already by using the search. |
| ||
Found some and converted it to use Extern. works well :-) Another nice debug stat for my framework to show. |