Share via


CMemFile::Alloc

This function is called by CMemFile member functions.

virtual BYTE* Alloc( 
   SIZE_T nBytes  
);

Parameters

  • nBytes
    Number of bytes of memory to be allocated.

Return Value

A pointer to the memory block that was allocated, or NULL if the allocation failed.

Remarks

Override this function to implement custom memory allocation. If you override this function, you'll probably want to override Free and Realloc as well.

The default implementation uses the run-time library function malloc to allocate memory.

Requirements

Header: afx.h

See Also

Reference

CMemFile Class

Hierarchy Chart

CMemFile::Free

CMemFile::Realloc

malloc