CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
IBM Rational 系统开发最佳实践工具包 WebSphere MQ 最佳实践 TOP 15
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

异常发生在HeapFree函数体中

楼主LAssemblyL()2006-03-04 00:55:55 在 VC/MFC / 基础类 提问

我正确的调用了HeapFree函数,但调试的时候发现,异常是发生在HeapFree函数体中的。这是怎么回事,如果HeapFree不成功就返回0啊,怎么会发生异常 问题点数:20、回复次数:4Top

1 楼snlux(snlux)回复于 2006-03-04 01:01:02 得分 0

有冲突嘛,仔细看看MSDN里的说明:)Top

2 楼LAssemblyL()回复于 2006-03-04 07:08:42 得分 0

Return   Values  
  Nonzero   indicates   success.    
   
  Zero   indicates   failure.    
   
  To   get   extended   error   information,   call   GetLastError.    
   
  Remarks  
  Serialization   ensures   mutual   exclusion   when   two   or   more   threads   attempt   to   simultaneously   allocate   or   free   blocks   from   the   same   heap.   There   is   a   small   performance   cost,   but   it   must   be   used   when   multiple   threads   allocate   and   free   memory   from   the   same   heap.    
   
  A   critical   section   is   always   used   to   serialize   access   to   an   individual   heap.   There   is   a   critical   section   per   heap   to   protect   access   to   each   heap.    
   
  An   attempt   to   grab   a   critical   section   that   is   not   owned   is   a   fast   path   operation   that   incurs   little   overhead.   This   is   similar   to   using   the   HEAP_NO_SERIALIZE   flag   if   only   one   thread   was   ever   accessing   a   particular   heap.    
   
  If   there   is   contention   for   the   critical   section   and   therefore   the   heap,   a   new   thread   request   to   allocate   heap   space   will   serialize.  
   
  没看到提示说什么冲突,很简单的一个程序,单线程  
  Top

3 楼LAssemblyL()回复于 2006-03-04 23:06:53 得分 0

没人知道?Top

4 楼Snow_Ice11111(雪上加冰)回复于 2006-03-05 00:37:06 得分 0

不贴出分配和回收相关的代码让人家如何分析?Top

相关问题

  • 如何在vbscript函数体中加入include
  • 在模块中如何调用窗体中的函数
  • 结构体中的函数???起到什么作用??
  • ResultSet作参数的函数,在函数体中使用这个rs怎么会出错?
  • 如何从一个窗体中调用另一个窗体的函数?
  • 一个(winform)窗体如何调用另一个窗体中的函数
  • 开源(Free):下载网页中的图片到窗体中(API函数)
  • 挑战:通过构造函数给结构体中的数组传递参数
  • 请问在窗体中没有mci控件,如只调用mcisendstring函数是否也可以在窗体中播放视频文件
  • C#中MDI窗体中的菜单代码如何调用另一个子窗体中的函数.我的代码调用不成功,代码如下:

关键词

  • 函数
  • heapfree函数
  • heap
  • 发生
  • critical section
  • thread
  • accessing

得分解答快速导航

  • 帖主:LAssemblyL

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo