delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/28/09:23:26

From: temujin AT sentex DOT net
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Malloc problem.
Date: Sat, 27 Jun 1998 00:27:43 -0400
Organization: Sentex Communications
Lines: 33
Message-ID: <359474BF.2A46@sentex.net>
References: <35939F88 DOT 5F0C AT sentex DOT net> <3593A433 DOT 68B2 AT rug DOT ac DOT be>
NNTP-Posting-Host: 209.112.40.61
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Vik Heyndrickx wrote:
> 
> temujin AT sentex DOT net wrote:
> >
> > I have a structure A which is 48 bytes.
> > In one function 550 A's get created with Malloc() and then when that
> > function exits and I try to malloc 5 bytes I get a General protection
> > fault, or when I try more then 500 I seem to get this problem of being
> > unable to use malloc.  BUT my program will work perfectly fine when the
> > number of A's does not exceed 500.  Is there some restriction on the
> > number of Malloc's you can use at a time?
> 
> This should not happen. The malloc() that comes with djdev201.zip has
> proven to be stable, so it is more likely that this problem is due to a
> program mistake of yours.
> 
> Could you please send the source code of the smallest program that
> produces this erratic behaviour to this newsgroup/mailing-list?
> 
> AFAIK there's no artificial restriction on the number of malloc()-ated
> blocks that is allocated at the same time.
> 
> --
>  \ Vik /-_-_-_-_-_-_/
>   \___/ Heyndrickx /
>    \ /-_-_-_-_-_-_/  Knight in the Order of the Unsigned Types


Well as it turns out it was my recursive function that was causing the
problem.  When it handles more then 7500 calls to itself it seems to go
off the deep end.  However the problem fixed itself when I switched over
to just a plain while loop.  
Lesson I learned was that Recursion just isn't worth it.

- Raw text -


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