| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付学习型 ASP/PHP/ASP.NET 主机 30元/年
高端软件开发 = 年薪十万不是梦赛孚耐:软件保护加密专家身份认证令牌USB KEY 
共有 289 人关注过本帖
标题:Question about heap corruption --- see screen plot for details.
收藏  订阅  推荐  打印
HJin
Rank: 12Rank: 12Rank: 12
等级:贵宾
威望:27
帖子:401
积分:4134
注册:2007-6-9
Question about heap corruption --- see screen plot for details.

I was writing my BigInt class to compute 500! The class uses dynamically allocated array as interal data member.

I got an error about "heap", which you can see from the attached .jpg file, although my program does give the correct answer for 500!:


12201368259911100687012387854230469262535743428031928421924135883858453731538819
97605496447502203281863013616477148203584163378722078177200480785205159329285477
90757193933060377296085908627042917454788242491272634430567017327076946106280231
04526442188787894657547771498634943677810376442740338273653974713864778784954384
89595537537990423241061271326984327745715546309977202781014561081188373709531016
35632443298702956389662891165897476957208792692887128178007026517450776841071962
43903943225364226052349458501299185715012487069615681416253590566934238130088562
49246891564126775654481886506593847951775360894005745238940335798476363944905313
06232374906644504882466507594673586207463792518420045936969298102226397195259719
09452178233317569345815085523328207628200234026269078983424517120062077146409794
56116127629145951237229913340169552363850942885592018727433795173014586357570828
35578015873543276888868012039988238470215146760544540766353598417443048012893831
38968816394874696588175045069263653381750554781286400000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000
Press any key to continue . . .


If you could help about the heap problem, I would be very much appreciated.

HJin

附件: 只有本站会员才能下载或查看附件,请您 登录注册
搜索更多相关主题的帖子: heap  corruption  plot  details  Question  
2007-7-5 18:47
aipb2007
Rank: 12Rank: 12Rank: 12
来自:CQU
等级:贵宾
威望:40
帖子:2881
积分:29412
注册:2007-3-18

不懂,HJin大哥把你代码弄出来,让我们好研究研究。

(*_*)

Fight  to win  or  die...
2007-7-5 20:53
HJin
Rank: 12Rank: 12Rank: 12
等级:贵宾
威望:27
帖子:401
积分:4134
注册:2007-6-9

almost there --- will release soon. I think it would be a very good practice for a beginner (not you) to learn operator overloading.

I've overloaded almost 20 operators.


I am working on a system which has no Chinese input. Please don\'t blame me for typing English.
2007-7-5 21:18
aipb2007
Rank: 12Rank: 12Rank: 12
来自:CQU
等级:贵宾
威望:40
帖子:2881
积分:29412
注册:2007-3-18

呵呵,20个,这么多啊!
那你加油吧!!!

》_《

Fight  to win  or  die...
2007-7-5 21:45
野比
Rank: 12Rank: 12Rank: 12
等级:贵宾
威望:14
帖子:990
积分:10576
注册:2007-5-24

哈... HJin开始弄你的BigNumber拉... 不是做1000!吗?... 变拉?
2007-7-5 22:06
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.098294 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved