From: Neil & Joey Obremski Newsgroups: comp.os.msdos.djgpp Subject: malloc errors Date: Sun, 05 Apr 1998 14:01:21 +0000 Organization: CyCLONE7 Design Lines: 32 Message-ID: <35278EB1.CDF435CC@nwrain.com> Reply-To: obremski AT nwrain DOT com NNTP-Posting-Host: 22008 AT 205 DOT 134 DOT 220 DOT 163 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I've had problems in some of my programs using 'new' which of course comes out using malloc anyway. I found this out quickly when a lot of my programs kept crashing and gdb kept saying malloc did it ;) I don't know if there's a problem with malloc in djgpp or not, but it certainly doesn't work 100% correctly when I use it. Some of my programs I spent hours debugging only to find that if I pass a constant added to a variable to my allocation function (Alloc I called it, wow pretty original =) malloc works fine, otherwise it doesn't. For example. I was messing around with a convenient "substring" style function that I was making. In one part I have: Alloc(newlen); This crashes the program after going past it only once or twice. However if I... Alloc(100); It works fine. Similarly: Alloc(newlen + 100); works fine as well. !??!?!? I have DJGPP 2.01. Has anyone else had this problem? -- /----------------------[nobremski AT hotmail DOT com]----------------------\ ( Neil C. Obremski Ashrak DeadEye ) \-----------------[http://www.nwrain.com/~deadeye/]-----------------/