C++翻译 Thanks

来源:百度知道 编辑:UC知道 时间:2024/06/08 18:49:53
Remarks
The free function deallocates a memory block (memblock) that was previously allocated by a call to calloc, malloc, or realloc. The number of freed bytes is equivalent to the number of bytes requested when the block was allocated (or reallocated, in the case of realloc). If memblock is NULL, the pointer is ignored and free immediately returns. Attempting to free an invalid pointer (a pointer to a memory block that was not allocated by calloc, malloc, or realloc) may affect subsequent allocation requests and cause errors.

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.

When the application is linked with a debug version of the C run-time libraries, free resolves to _free_dbg. For more information abou

free函数用来释放 由calloc,malloc,realloc申请的内存块。释放的内存字节数和申请的字节数相同。如果传入NULL内存块,操作将被忽略并且函数立即返回。试图释放无效指针时(未由calloc,malloc,realloc调用申请的内存块),可能影响后续的内存申请请求并产生错误。

内存块被释放后,_heapmin 调用 收集堆中的未使用区域并将它们释放并交还操作系统,使得堆中的剩余空间达到最小。 未被释放回操作系统的空闲内存资源被存储在空闲池中以备再次被申请。

当和应用程序链接的是debug版的C运行时库时,free函数解析为_free_dbg。要了解关于堆在调试进程中如何被管理的信息,请参见《使用C运行时库调试支持》