Re: [cc65] memory corruption?

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-06-03 00:49:28


On Mon, Jun 02, 2003 at 11:57:35PM +0200, MagerValp wrote:
> What could make a call to free fail? Suddenly, this code in simplemenu
> freezes:
[...]
> It works fine by itself, but after I use my file selector and load and
> convert a file, the free call never returns.

free() will add most blocks to the free list, which is a double linked
list of free blocks. Links are stored inside the freed blocks. Any form of
memory corruption may cause free() to enter an endless loop.

Your best chance is to look through the code for memory block overwrites.
If I remember correctly, you had a special affinity for code like this:

        struct x* X = malloc (sizeof (X));

So I would look out for similar problems:-)

Other possibility: If the code compiles&runs on a PC, use a malloc
debugger on the PC.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-06-03 00:49:47 CEST