Editéieren

Deelen iwwer


Memory Management: Resizable Memory Blocks

Note

The Microsoft Foundation Classes (MFC) library continues to be supported. However, we're no longer adding features or updating the documentation.

The new and delete operators, described in the article Memory Management: Examples, are good for allocating and deallocating fixed-size memory blocks and objects. Occasionally, your application may need resizable memory blocks. You must use the standard C run-time library functions malloc, realloc, and free to manage resizable memory blocks on the heap.

Important

Mixing the new and delete operators with the resizable memory-allocation functions on the same memory block will result in corrupted memory in the Debug version of MFC. You should not use realloc on a memory block allocated with new. Likewise, you should not allocate a memory block with the new operator and delete it with free, or use the delete operator on a block of memory allocated with malloc.

See also

Memory Management: Heap Allocation