Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!dimacs.rutgers.edu!seismo!ukma!rex!wuarchive!udel!haven!umbc3!umbc5.umbc.edu!cs483106 From: cs483106@umbc5.umbc.edu (cs483106) Newsgroups: comp.sys.mac.programmer Subject: Re: Novice question about malloc() in Think C Message-ID: <5145@umbc3.UMBC.EDU> Date: 25 Feb 91 20:21:56 GMT References: <1991Feb25.103404.3662@Neon.Stanford.EDU> <12591@helios.TAMU.EDU> Sender: newspost@umbc3.UMBC.EDU Reply-To: cs483106@umbc5.umbc.edu.UUCP (cs483106) Distribution: usa Organization: University of Maryland, Baltimore County Lines: 25 In article <12591@helios.TAMU.EDU> n138ct@tamuts.tamu.edu (Brent Burton) writes: >What I did was to surround every malloc() call with this: >#ifdef THINK_C > x = (char *)NewPtr((long)sizeof(char)); >#else > x = (char *)malloc(sizeof(char)); >#endif >I also added this: >#ifdef THINK_C >#define free(x) DisposPtr((x)) >#endif I too have had problems with THINK C's malloc. I have taken the easy way out and simply ripped everything out of alloc.c, and replaced it with glue code to the Inside Mac equivalents. (I got too annoyed at doing a #define for every malloc I used!) I did the job about a month ago, It took me about an hour (I'm not all that great at 'asm' programming), and seems to be working great. actually, quite a bit of the original stuff can be used as examples of how to call NewPtr from an 'asm' directive. "Pope" Q.E.D Michael Kohne