delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/06/10:51:47

From: tomw AT tsys DOT demon DOT co DOT uk (Tom Wheeley)
Subject: Segfault in malloc.
Message-ID: <844459022snz@tsys.demon.co.uk>
Date: Fri, 04 Oct 96 19:57:02 GMT
Organization: Adventures and Diving
Reply-To: tomw AT tsys DOT demon DOT co DOT uk
Lines: 15
Newsgroups: comp.os.msdos.djgpp
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

A reasonably large program I am writing *sometimes* crashes out with a Page
Fault.  When I run symify, the fault appears to be in malloc
( _malloc+192 to be exact).  However, I suspect this is caused by a wild
pointer of my own.

Tracing the flow, the error occurs in the middle of a lot of small mallocs
(generally 1 - 10 bytes).

AFAICS, I have set all my pointers to be initialised to NULL, but the error
still occurs sometimes.  I'm using -O3 at the moment.

Any help appreciated!

.splitbung (pwei barmy army, essex paragraph)     http://www.tsys.demon.co.uk
-- 
#include <stdio.h>                  /* The .splitbung super .sig system! */
#include <string.h>
main(){FILE *f;int c;char s[99];puts("fav .sig: ");fgets(s,99,stdin);strtok
(s,"\n");f=fopen(s,"rb");while((c=getc(f))!=EOF)putchar(c);if(f)fclose(f);}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019