Mail Archives: djgpp/1996/04/10/04:15:31
j DOT aldrich6 AT genie DOT com wrote:
>
> Reply to message 5073138 from JESUS AT MATRUST on 04/09/96 4:42AM
>
> > for (i = 0; i < 5000; i++)
> > {
> > malloc (10000);
> > printf ("%d\n", i);
> > }
>
> This may not be your problem, but shouldn't you test to see if malloc() fails
> before continuing in your loop? Allocating fifty (or even ten) megabytes of
> memory is hardly a guaranteed proposition.
>
> On the other hand, I can see no reason why malloc would cause a crash if
> it ran out of memory...
You are right John. I should test to see if malloc () fails. I do so in the
radiosity program I'm developing and it crashes. That's not the problem.
The simple/sample program I posted it's the minimum number of instructions to
generate the error (not a way to allocating memory).
Thanks for your answer.
Jesus.
--------------------------------------------------------------------------------
DIGITAL ILLUSION * Grup Matrust
Jesus Canal Trav. de les Corts, 222 * 08028 Barcelona (Spain)
Software Enginner Tel. (34-3) 409 01 15 * Fax (34-3) 409 01 16
email: jesus AT matrust DOT es * http: www.matrust.es
--------------------------------------------------------------------------------
- Raw text -