Path: chuka.playstation.co.uk!news From: Chris Chadwick Newsgroups: scee.yaroze.programming.gnu_compiler Subject: Memory allocation probs... Date: Mon, 27 Oct 1997 14:54:45 -0800 Organization: PlayStation Net Yaroze (SCEE) Lines: 27 Message-ID: <34551BB5.58BA@dial.pipex.com> NNTP-Posting-Host: af130.du.pipex.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 2.02 (Win95; I; 16bit) Hi and, er... HELP! Does anyone know if there's a problem with the GNU library memory allocation functions, specifically calloc()? All seems to work fine for normal situations, but if I call calloc() - as shown below - with numSprites set at a ludicrous value of say, 20000, the 'after...' message never gets displayed. This leads me to believe that, in this situation, calloc() never returns (not even with a NULL pointer) and the whole system hangs :( GsSPRITE *p; printf("before...\n"); if ((p = (GsSPRITE *) calloc(numSprites, GsSPRITE_SIZE))==NULL) printf("\nFailed to allocate memory for sprites\n"); printf("after...\n"); I came across this problem while trying to track down another bug, so I would like to get this sorted before I continue (Mmmm, lovely debugging session without the aid of a debugger). I'm certainly not a 'C guru', so I may be missing/doing something really stoopid. BTW, I'm compiling with 0 optimization and linking to the default 0x80100000 address, if that helps. Thanks in advance, Chris