Mail Archives: djgpp/2007/01/04/01:18:06

X-Authentication-Warning: mail set sender to djgpp-bounces using -f
NNTP-Posting-Date: Wed, 03 Jan 2007 23:41:03 -0600
Message-ID: <>
Date: Thu, 04 Jan 2007 00:29:09 -0500
From: CBFalconer <cbfalconer AT yahoo DOT com>
Organization: Ched Research
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp,comp.lang.c
Followup-To: comp.lang.c
Subject: Re: Request
References: <459aeaf9$0$27394$ba4acef3 AT news DOT orange DOT fr>
<8cOdneCGIKdOvgbYnZ2dnUVZ_smonZ2d AT giganews DOT com>
<NMydnaC_tuIAuAbYnZ2dnUVZ_uqvnZ2d AT giganews DOT com> <459B6207 DOT 8E56482 AT yahoo DOT com> <459C66E6 DOT 1070902 AT alex3>
Lines: 60
X-Trace: sv3-dgwrzQhT2w7AxN9XJpqlPBuZC8gonw9eKxItHkAUucMk5lfq8/47yKTbuSHUP9IGyPHrx5GZUVyeCFh!zsQTAdlqUEOKz+AocyhtRaa1Th+O4BiOcViGyhP1Wv10DEaBxOkfPVwEy04RTQw=
X-Complaints-To: abuse AT gwi DOT net
X-DMCA-Complaints-To: abuse AT gwi DOT net
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.32
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

alex bodnaru wrote:
> CBFalconer wrote:
>> "David T. Ashley" wrote:
>> ... snip ...
>>> 54135^2 is going to be on the order of 2.5G.  That is a pretty
>>> fair hunk of memory.
>>> ---------
>>> [nouser AT pamc ~]$ cat test3.c
>>> #include <stdio.h>
>>> #include <stdlib.h>
>>> int main(void)
>>>    {
>>>    char *p;
>>>    int i;
>>>    for (i=65535; i>0; i--)
>>>       {
>>>       if (p = calloc(i,i))
>>>          {
>>>          printf("%d is apparently the largest integer that will succeed.\n",
>>> i);
>>>          break;
>>>          }
>>>       }
>>>    }
>>> [nouser AT pamc ~]$ gcc test3.c
>>> [nouser AT pamc ~]$ ./a.out
>>> 54135 is apparently the largest integer that will succeed.
>>> [nouser AT pamc ~]$
>> With DJGPP 2.03 (specifies the library) that crashes immediately in
>> memset.  With nmalloc linked in in place of the library it yields
>> 23093.
>> Advisory cross-post to comp.os.msdos.djgpp, f'ups set to clc.
> even the first malloc is 4gb, and i doubt you have more ;-)

Which should simply fail.  The code is looking for the largest
assignable value and for foulups in the calloc multiply operation. 
It shouldn't crash.  nmalloc fails and returns NULL.  DJGPP malloc
claims to succeed, but doesn't, and the memset crashes.  This also
shows the need to include calloc in the nmalloc package, to ensure
the same limits are observed.

Why did you override the follow-up I had set?  And top-post. 
Please go to comp.lang.c for further general discussion of this. 
Meanwhile, be aware of the DJGPP bug.

Chuck F (cbfalconer at maineline dot net)
   Available for consulting/temporary embedded and systems.

- Raw text -

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