Mail Archives: djgpp/1997/11/27/10:58:00
> 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 -