Message-ID: <3F1DACE5.3080903@student.kuleuven.ac.be> Date: Tue, 22 Jul 2003 23:30:13 +0200 From: Peter Claessens User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en,pdf MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: malloc/free blues References: <3F156434 DOT 3000508 AT psy DOT kuleuven DOT ac DOT be> In-Reply-To: <3F156434.3000508@psy.kuleuven.ac.be> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by KULeuven Antivirus Cluster Reply-To: peter DOT claessens AT psy DOT kuleuven DOT ac DOT be My problem is finally solved now... I did the following: I installed djdev 2.04, where malloc_debug and malloc_verify are implemented in the libc, recompiled with malloc debugging level to 4. I had to use some tricks to read the error output, because right after the abort due to the memory problem, I got in an infinite 'abort' loop somewhere in the allegro_exit function. It turned out that the 'fixpage' pointer (see first post, with the code) and the associated struct fields were always involved in these crashes. Then I suddenly spotted the problem in my code. Normally I set a pointer to NULL after deleting its object, and I do the same for bitmap pointers after calling destroy_bitmap; I check pointers against being zero before trying to delete or destroy them. Forgetting to set the pointer to NULL after a destroy_bitmap one time was enough to cast this nightmare upon me. I added the line to do so, and behold.... my program doesn't crash. I deleted the malloc_dbug statement though, because of the errors I receive when shutting down the program. Conclusion: I lost a lot of time, but at least I learned a lot about debugging. Many thanks to everyone who helped me sorting out this problem! Cheers, Peter.