Debug error: heap corruption detected

Are you developing an External using the LiveCode Externals SDK?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Location: Aalst, Belgium
Contact:

Debug error: heap corruption detected

Post by Janschenkel » Sat Mar 28, 2009 11:03 am

Still working on the same external - no more Run-Time check failures, but now I'm encountering my second problem.

I call into the other library, which returns a string with the correct data (inside the debugger anyway), which I copy into a new char buffer to hand back to Revolution. As soon as I come out of my function, I get the following message from the Microsoft Visual C++ Debug Library:
Debug error!

Program: C:\Program Files\Revoluton Enterprise\3.0.0-gm-3\Revolution.exe

HEAP CORRUPTION DETECTED: after Nortmal block (#84) at 0x02086EE8.
CRT detected that the application wrote to memory after end of heap buffer.

(Press Retry to debug the application)

(Abort) (Retry) (Ignore)
Pressing Retry doesn't help of course, as I can't debug Revolution :-)
Pressing Ignore lets me continue, but the result of the external function call is empty.

Any ideas?

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Location: Aalst, Belgium
Contact:

Post by Janschenkel » Tue Mar 31, 2009 7:20 pm

For others facing this problem, it turned out to be a problem with my return values: I made an error in the return value size calculation, thereby returning a string that had one byte too many allocated to it.
At least I was consistent in my error, so once realization sank in, it was a quick fix accross the source code.

Slowly moving forwards, but glad to see actual values coming through :-)

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Post by mwieder » Wed Apr 01, 2009 6:39 am

I was just gonna suggest that maybe you're copying a string into a buffer that's too small... Great! Now on to the next bug...

Post Reply

Return to “Building Externals”