delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/04/22/11:15:33

From: gehok55 AT hotmail DOT com (Josh)
Newsgroups: comp.os.msdos.djgpp
Subject: nasty problems with free()
Date: Sun, 22 Apr 2001 13:28:25 GMT
Message-ID: <3ae2dc55.2557776@news.dingoblue.net.au>
X-Newsreader: Forte Free Agent 1.21/32.243
Lines: 39
NNTP-Posting-Host: 198.142.81.134
X-Trace: 987945955 news01.syd.optusnet.com.au 25502 198.142.81.134
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

ive been having some problems with freeing up some allocated memory.
i use : 
	typedef struct {
        	    int x,y;
	}Point;
and
	Point *p = calloc(n, sizeof(Point));
to create an array of N point's
then i play with the values a bit in the array (nothing unusual)
but when i call   cfree(p);  
it will either drop back to windows (saying there was a some fault) or
reboot my computer (this happens most of the time) :(
after 20 odd reboots, 4 cups of coffee and alot of tinkering that got
me nowhere, I thought i'd consult with the masters :)

ive placed my C code on my homepage for people to have a look at since
it is too long to post here. It should compile straight away without
any errors (youll need allegro) and only the calloc() and cfree() in
main() needs to be examined. The rest of the functions work fine and
do their jobs (so you shouldnt have to read/understand all the little 
functions.. just a few lines in main)

here it is :
http://members.dingoblue.net.au/~10archway/djgpp/npolyswivel.c

im running full sreen dos from win98se. im using gcc version 2.953,
rhide and allegro (WIP) 3.9.34 (although i dont think this is
allegro's fault)

I am thinking that i should change some of the dos programs properties
(right click properties in explorer).. maybe im free'ing some ram that
windows is using.. maybe its just my machine.
please reply via this group, or email with any suggestions, comments
or abuse.

thankyou

-Josh
gehok55 AT hotmail DOT com

- Raw text -


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