I'm searching a command which can get the memory size, something like :
size = MemorySize(memory_id#)
But it doesn't seems to exist in Purebasic...
Memory Size
Re: Memory Size
You can do it with the GlobalSize API command like this:
Code: Select all
Unknown=Random(99999)
MemID=AllocateMemory(1,Unknown,0)
Debug Unknown
Debug GlobalSize_(MemID)
or:
Code: Select all
GlobalMemoryStatus_(Memory.MEMORYSTATUS)
Debug "Memory length: " + Str(Memory\dwLength) + "bit"
Debug Str(Memory\dwMemoryLoad) + "% of memory is being used"
Debug "Total installed memory: " + Str(Memory\dwTotalPhys) + " bytes"
Debug "Available memory for use: " + Str(Memory\dwAvailPhys) + " bytes"
Debug "Total page file size: " + Str(Memory\dwTotalPageFile) + " bytes"
Debug "Page file available for use: " + Str(Memory\dwAvailPageFile) + " bytes"
Debug "Total virtual memory size: " + Str(Memory\dwTotalVirtual) + " bytes"
Debug "Virtual memory available for use: " + Str(Memory\dwAvailVirtual) + " bytes"
- tinman
- PureBasic Expert

- Posts: 1102
- Joined: Sat Apr 26, 2003 4:56 pm
- Location: Level 5 of Robot Hell
- Contact:
Despite what the platform SDK says, I found that I had to manually set the length in the structure (seemed that GlobalMemoryStatus used it as a check to ensure the pointer to the structure was valid).Kale wrote:or:Code: Select all
GlobalMemoryStatus_(Memory.MEMORYSTATUS)
I'm sure my old Win32 reference manual mentioned that, but not the platform SDK.
Besides, that gets info about the system memory, not the size of the memory already allocated ;p
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
(WinXPhSP3 PB5.20b14)


