Announcement

Collapse
No announcement yet.

Corrupt Heap

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Corrupt Heap

    I am having problems with my PB made program causing a
    Kernel32 crash in the RtlFreeHeap function.

    I am not using any API functions or DDT. I am using pointers.

    I think it is a corrupt heap.

    What PB functions/statements misuse/errors could cause
    a corrupt heap?

    Bad Pointers? Redim?

    Is the heap shared by all other programs running on the system?
    I.E. could another program cause the heap corruption that is
    crashing my program? This is an intermittant NT only problem,
    Windows 98 does not crash.


    Code:
    function: RtlFreeHeap
            77f64c69 85db             test    ebx,ebx
            77f64c6b 0f85a1000000     jne     RtlFreeHeap+0x1ec (77f64d12)
            77f64c71 ffb6b8040000     push    dword ptr [esi+0x4b8]  ds:001404b8=00140548
            77f64c77 e864280000       call    RtlLeaveCriticalSection (77f674e0)
            77f64c7c e991000000       jmp     RtlFreeHeap+0x1ec (77f64d12)
            77f64c81 83ef18           sub     edi,0x18
            77f64c84 85db             test    ebx,ebx
            77f64c86 897df8           mov     [ebp-0x8],edi          ss:0104e3e6=????????
            77f64c89 8b0f             mov     ecx,[edi]              ds:0023dfb0=7effffff
            77f64c8b 8b4704           mov     eax,[edi+0x4]          ds:0115c9b6=????????
    FAULT ->77f64c8e 8908             mov     [eax],ecx              ds:7dfffff7=????????
            77f64c90 894104           mov     [ecx+0x4],eax          ds:7ff1ea05=????????
            77f64c93 750b             jnz     RtlFreeHeap+0x17a (77f64ca0)
            77f64c95 ffb6b8040000     push    dword ptr [esi+0x4b8]  ds:001404b8=00140548
            77f64c9b e840280000       call    RtlLeaveCriticalSection (77f674e0)
            77f64ca0 6800800000       push    0x8000
            77f64ca5 8d45fc           lea     eax,[ebp-0x4]          ss:0104e3e6=????????
            77f64ca8 50               push    eax
            77f64ca9 8d4df8           lea     ecx,[ebp-0x8]          ss:0104e3e6=????????
            77f64cac c745fc00000000   mov    dword ptr [ebp-0x4],0x0 ss:0104e3e6=????????
            77f64cb3 51               push    ecx
            77f64cb4 6aff             push    0xff
    
    eax=7dfffff7 ebx=00000000 ecx=7effffff edx=00140548 esi=00140000 edi=0023dfb0
    eip=77f64c8e esp=0012f9c8 ebp=0012f9e0 iopl=0         nv up ei pl zr na po nc
    cs=001b  ss=0023  ds=0023  es=0023  fs=0038  gs=0000             efl=00000246
    
    *----> Stack Back Trace <----*
    
    FramePtr ReturnAd Param#1  Param#2  Param#3  Param#4  Function Name
    0012f9e0 77f11eb0 00140000 00000000 0023dfd0 00000000 ntdll!RtlFreeHeap 
    0012fa24 0026eef6 0023dfd0 0026e562 00275484 00000000 kernel32!GlobalFree



    ------------------

  • #2
    Tim, which version of NT are you running? NT4/SP4 has been known to give all sorts of problems in the past.

    Can you prune the code down until the problem goes away? It may give you a clue as to where things are going astray.

    There are various KB articles on "rtlfreeheap" on MDSN... for example http://support.microsoft.com/support.../Q189/6/12.ASP

    Otherwise, if you can submit the smallest possible compilable code to Tech Support, we may be able to take a look at it for you.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      The NT version number is:
      Windows Version: 4.0
      Build: 1381
      Service Pack 4

      Most likely it is an OS problem. I am trying to isolate the
      part of the program that causes the crash. This is a very
      hard one to find since the problem is highly intermittant.
      Moves around in the code and seems to be related to parts
      of the code that use redim. Does redim free heap space?
      Windows 2000, 95, 98, ME do not have this problem with the
      program.

      Bugs in the NT 4 OS, How could that be?

      Tim


      [This message has been edited by Tim Wisseman (edited October 08, 2000).]

      Comment


      • #4
        Does the error occur with #Debug Error On?

        ------------------
        Ron

        Comment


        • #5
          Yes, it does happen with #Debug Error on.

          ------------------

          Comment


          • #6
            Lance, NT 4 service pack 6 made the error go away.

            Tim


            ------------------

            Comment


            • #7
              Thanks for the confirmation! SP4 needs to be taken out and shot where-ever it is found...

              ------------------
              Lance
              PowerBASIC Support
              mailto:[email protected][email protected]</A>
              Lance
              mailto:[email protected]

              Comment

              Working...
              X