Xref: news2.mv.net comp.os.msdos.djgpp:5718 From: Charles Sandmann Newsgroups: comp.os.msdos.djgpp Subject: Re: Page fault after return from main() Date: Sun, 07 Jul 1996 21:18:56 CDT Organization: Rice University, Houston, Texas Lines: 13 Message-ID: <31e07010.sandmann@clio.rice.edu> References: <4rp66c$p27 AT ralph DOT vnet DOT net> Reply-To: sandmann AT clio DOT rice DOT edu NNTP-Posting-Host: clio.rice.edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp > My program gives the following error message after it returns from main(): > Page fault cr2=10000010 at eip=14b6c; flags=3216 The exit code is trying to access a bad pointer (0x10), probably in the cleanup of closing handles, doing atexit routines, etc. The exception handler is from CWSDPMI, so it's happened AFTER the DJGPP code has unhooked it's exception handler. You have a bug in your program - you are overwriting memory that the libc routines use in cleanup. > If I run the program repeatedly, it will crash with SIGSEGV inside > malloc. What could be causing this? Bad pointers, use of uninitialized variables (especially pointers).