¿Le resultó útil esta página?
Sus comentarios sobre este contenido son muy importantes. Háganos saber su opinión.
¿Tiene comentarios adicionales?
Caracteres restantes: 1500
Exportar (0) Imprimir
Expandir todo
Expandir Minimizar
Importante Es posible que este documento no represente los procedimientos recomendados para el desarrollo actual. Puede que los vínculos a las descargas y otros recursos ya no sean válidos. Encontrará aquí la versión que se recomienda en la actualidad.


Deallocates or frees a memory block.

void _freea( 
   void *memblock 



Previously allocated memory block to be freed.

The _freea function deallocates a memory block (memblock) that was previously allocated by a call to _malloca. _freea checks to see if the memory was allocated on the heap or the stack. If it was allocated on the stack, _freea does nothing. If it was allocated on the heap, the number of freed bytes is equivalent to the number of bytes requested when the block was allocated. If memblock is NULL, the pointer is ignored and _freea immediately returns. Attempting to free an invalid pointer (a pointer to a memory block that was not allocated by _malloca) might affect subsequent allocation requests and cause errors.

_freea calls free internally if it finds that the memory is allocated on the heap. Whether the memory is on the heap or the stack is determined by a marker placed in memory at the address immediately preceding the allocated memory.

In Visual C++ 2005, if an error occurs in freeing the memory, errno is set with information from the operating system on the nature of the failure. For more information, see errno, _doserrno, _sys_errlist, and _sys_nerr.

After a memory block has been freed, _heapmin minimizes the amount of free memory on the heap by coalescing the unused regions and releasing them back to the operating system. Freed memory that is not released to the operating system is restored to the free pool and is available for allocation again.

A call to _freea must accompany all calls to _malloca. It is also an error to call _freea twice on the same memory. When the application is linked with a debug version of the C run-time libraries, particularly with _malloc_dbg features enabled by defining _CRTDBG_MAP_ALLOC, it is easier to find missing or duplicated calls to _freea. For more information about how the heap is managed during the debugging process, see The CRT Debug Heap.

_freea is marked __declspec(noalias), meaning that the function is guaranteed not to modify global variables. For more information, see noalias.

Function Required header Compatibility


<stdlib.h> and <malloc.h>

Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003

For more compatibility information, see Compatibility in the Introduction.

See the example for _malloca.

Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.

Adiciones de comunidad

© 2015 Microsoft