www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/27/10:58:00

From: "Tom Demmer" <DEMMER AT brain1 DOT lstm DOT ruhr-uni-bochum DOT de>
Organization: Lehrstuhl Stroemungsmechanik, RUB
To: gaggi AT dulcamara DOT cs DOT unibo DOT it (Nicola Gaggi), djgpp AT delorie DOT com
Date: Thu, 27 Nov 1997 16:56:24 GMT-1
Subject: Re: malloc() bug?
Reply-to: Demmer AT LStM DOT Ruhr-Uni-Bochum DOT De
Message-ID: <A299EE61924@brain1.lstm.ruhr-uni-bochum.de>

> I am wondering if anyone out there has had the same problem:
> I am writing a program that need to dinamically allocate a huge number of
> little buffers (about 10 bytes each), but I have run into problem with
> malloc(), i receive SIGSEGV inside the malloc() code. 
> The program code seems correct, and anyway it is not particularly
> complicate, it only performs some allocation and copy, so what it can be?
> Every malloc'ed pointer is free'ed up correctly. 
> Is it a bug of malloc() function? Any suggestion? 
> 

malloc() is pretty bug free and I never heard of SIGSEGVs inside 
malloc when the user code was bug free. So I'd guess you have some 
flaws in your code. Leave away the copy instructions for fun, just to 
see if it crashes then. OTOH, there is a slight possibility of 
malloc() returning NULL when there is still plenty of memory floating 
around. Have you checked that? I know that it's tempting just to 
malloc without caring what you get.  But for that we'd need to know 
what ``huge'' is exactly. 100, 1000, 10000, 100000?

Ciao
Tom

  ******************************************************************
  *  Thomas Demmer                     * Phone : +49 234 700 6434  *
  *  Universitaetsstr. 150             * Fax   : +49 234 709 4162  *
  *  Lehrstuhl fuer Stroemungsmechanik *                           *
  *  D-44780 Bochum                    *                           *
  ******************************************************************
  *  Email: demmer AT LStM DOT Ruhr-Uni-Bochum DOT De                         *
  *  WWW:   http://www.lstm.ruhr-uni-bochum.de/~demmer             *
  ******************************************************************

    You've got to stand for something
    Or you're gonna fall for anything
                                    --- John Mellencamp

- Raw text -


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