| www.delorie.com/archives/browse.cgi | search |
| From: | j DOT aldrich6 AT genie DOT com |
| Message-Id: | <199604100421.AA172870100@relay1.geis.com> |
| Date: | Wed, 10 Apr 96 03:59:00 UTC 0000 |
| To: | djgpp AT delorie DOT com |
| Mime-Version: | 1.0 |
| Subject: | malloc crash |
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...
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |