HEAP[Server.exe]: Heap block at 02A6B9A8 modified at 02A6DD60 past requested size of 23b0

解决方案 »

  1.   

    没有递归,我的程序频繁的new了一个60*150byte的空间,不过每次都delete掉了。什么情况下会造成堆溢出? 每次只申请60*150byte也不多啊。
      

  2.   

    u'd check ur code about the heap memory just paste a snippet of MSDN, see more details by yourself //// 
    Memory Management: Heap Allocation
    Home |  Overview |  How Do IThe heap is reserved for the memory allocation needs of the program. It is an area apart from the program code and the stack. Typical C programs use the functions malloc and free to allocate and deallocate heap memory. The Debug version of MFC provides modified versions of the C++ built-in operators new and delete to allocate and deallocate objects in heap memory. When you use new and delete instead of malloc and free, you are able to take advantage of the class library’s memory-management debugging enhancements, which can be useful in detecting memory leaks. When you build your program with the Release version of MFC, the standard versions of the new and delete operators provide an efficient way to allocate and deallocate memory (the Release version of MFC does not provide modified versions of these operators).Note that the total size of objects allocated on the heap is limited only by your system’s available virtual memory.
      

  3.   

    这个程序是一个网络的服务器程序,每次接受到一个client的连接后,会将已经连接到server上的所有client的信息发送给刚刚连接的client.一个信息的结构大小的150byte,当服务器上有大概80多人的时候,会出现这种情况。是堆太小了?
      

  4.   

    qing_li73(bluemoon) :
    "Note that the total size of objects allocated on the heap is limited only by your system’s available virtual memory."
    理论上60*150byte应该不会超出system virtual memory吧。
      

  5.   

    我上次也遇到了一个和你类似的问题,但是当时我是把CString:GetBuffer()
    以后,直接用delete 删除以后 才出现这个问题的;我申请的空间是30K;但
    好象也没有溢出。
      

  6.   

    对,我的问题只是在delete的时候发生