免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2889 | 回复: 2
打印 上一主题 下一主题

请教:malloc realfree出错 谢谢 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-01-22 21:46 |只看该作者 |倒序浏览
我的程序运行在SunOS 5.8上。
程序运行过程中会出中断,而且总是出在与malloc相关的地方,如:malloc,fputs,printf 而且出问题的地址好象都是一样的“in realfree at 0xfee41b78”

例如:
t@36 (l@3) signal SEGV (no mapping at the fault address) in realfree at 0xfee41b78
0xfee41b78: realfree+0x0108: st %i3, [%i3 + %o0]
Current function is LwtRecvTask
304 printf("aaaaaaaaaaaaa\r\n",);
(dbx)where
current thread: t@36
[1] realfree(0x3987b60, 0xfeebe8b0, 0xfeeb8018, 0x3987b28, 0x39, 0x3987b30), at 0xfee41b78
[2] cleanfree(0x0, 0xfeeb8018, 0xfeebe824, 0xfeebe8a4, 0xfeebe824, 0x0), at 0xfee423e4
[3] _malloc_unlocked(0x4, 0x0, 0xfeeb8018, 0x8, 0xfecf9d98, 0x0), at 0xfee41518
[4] malloc(0x4, 0xfae0aeb4, 0xfecee000, 0x2, 0x1c054, 0xfee6e33, at 0xfee4140c

例如:
dbx: warning: stepping up to a function with srcline info
t@48 (l@46) signal SEGV (no mapping at the fault address) in realfree at 0xfee41b78
0xfee41b78: realfree+0x0108: st %i3, [%i3 + %o0]
Current function is Func1
377 p_packet = (T_MyStruct*)malloc(wSLen);
(dbx)where
current thread: t@48
[1] realfree(0x39864c8, 0xfeebe8b0, 0xfeeb8018, 0x3986490, 0x39, 0x398649, at 0xfee41b78
[2] cleanfree(0x0, 0xfeeb8018, 0xfeebe824, 0xfeebe8a4, 0xfeebe824, 0x0), at 0xfee423e4
[3] _malloc_unlocked(0x9, 0x0, 0xfeeb8018, 0x10, 0xfeebf1b8, 0x0), at 0xfee41518
[4] malloc(0x9, 0x0, 0x0, 0xfeebb7b1, 0xf9e03602, 0x119d6d), at 0xfee4140c

论坛徽章:
0
2 [报告]
发表于 2003-01-23 09:59 |只看该作者

请教:malloc realfree出错 谢谢

SEGV 信号表示你的程序对非法内存进行引用
所以会出错

检查一下是不是内存地址非法

论坛徽章:
0
3 [报告]
发表于 2004-09-01 19:28 |只看该作者

请教:malloc realfree出错 谢谢

我也遇到类似问题,迷惑
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP