IMalloc::GetSize method (objidlbase.h)

Retrieves the size of a previously allocated block of memory.


SIZE_T GetSize(
  [in] void *pv


[in] pv

A pointer to the block of memory.

Return value

The size of the allocated memory block in bytes or, if pv is a NULL pointer, -1.


To get the size in bytes of a memory block, the block must have been previously allocated with IMalloc::Alloc or IMalloc::Realloc. The size returned is the actual size of the allocation, which may be greater than the size requested when the allocation was made.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header objidlbase.h (include ObjIdl.h)

See also