delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/06/05/15:42:48

Date: Fri, 5 Jun 92 14:53:12 EDT
From: DJ Delorie <dj AT ctron DOT com>
To: mimperat AT cs DOT dal DOT ca
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: malloc() doesn't return a null pointer when out of memory

> I can certainly see how malloc() could not easily detect that the
> swap disk is full but it should be able to easily see if there is not
> enough virtual memory to satisfy the request.

Swap space IS your virtual memory.  In order to detect that malloc()
should return NULL, you have to figure out how much swap space you
would need if you suddenly referenced ALL the memory in the program,
and see if the disk currently has enough space to handle that request.
It's not a trivial piece of code to keep track or and/or compute that
information.

If it's that much of an issue for you, MAKE THE CHANGES YOURSELF!
That's why I send out source code - if you don't like it, change it.

DJ
dj AT ctron DOT com
Life is a banana.

- Raw text -


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