打印

请教动态内存释放函数free

[复制链接]
2637|5
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
ayb_ice|  楼主 | 2011-10-26 08:36 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
沙发
上官金虹| | 2011-10-26 09:06 | 只看该作者
http://www.cplusplus.com/reference/clibrary/cstdlib/free/

void free ( void * ptr );
Deallocate space in memory

A block of memory previously allocated using a call to malloc, calloc or realloc is deallocated, making it available again for further allocations.

Notice that this function leaves the value of ptr unchanged, hence it still points to the same (now invalid) location, and not to the null pointer.

Parameters
ptr
Pointer to a memory block previously allocated with malloc, calloc or realloc to be deallocated.
If a null pointer is passed as argument, no action occurs.

Return Value
(none)

使用特权

评论回复
评分
参与人数 1威望 +1 收起 理由
ayb_ice + 1
板凳
上官金虹| | 2011-10-26 09:08 | 只看该作者
C99 标准:

Image0511.JPG (28.59 KB )

Image0511.JPG

Image0512.JPG (13.18 KB )

Image0512.JPG

使用特权

评论回复
评分
参与人数 1威望 +1 收起 理由
ayb_ice + 1
地板
ayb_ice|  楼主 | 2011-10-26 09:46 | 只看该作者
感谢"上官金虹"
分数给你了,虽然少了点

使用特权

评论回复
5
sedatefire| | 2012-7-9 16:58 | 只看该作者
表示很困惑,51中使用free???
没有操作系统支持,跟谁去申请或释放内存啊

使用特权

评论回复
6
sedatefire| | 2012-7-9 16:59 | 只看该作者
即使是轻量级的ucos,也不支持malloc和free的
heap的设置我都是直接置零的
包括M3的堆设置,也是直接清0

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

222

主题

15435

帖子

34

粉丝