delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/06/05/14:38:03

From: Eric Backus <ericb AT lsid DOT hp DOT com>
Subject: Re: malloc() doesn't return a null pointer when out of memory
To: greve AT rs1 DOT thch DOT uni-bonn DOT de
Date: Fri, 5 Jun 92 10:51:26 PDT
Cc: daniel AT asd470 DOT dseg DOT ti DOT com, djgpp AT sun DOT soe DOT clarkson DOT edu
Mailer: Elm [revision: 66.25]

> Since gcc is a Unix compiler, it is thought to give you as much memory as
> you need. It should *never* let you run out of memory. Especially malloc
> cannot see when your disk is full...

I don't agree.  My unix workstation still has a (fairly large) limited
amount of virtual memory.  If I exceed this, malloc fails and returns
NULL.  Yes, I have checked this myself, and this is standard behavior.

> BTW: keep your memory requirements in a reasonable proportion to your available
> RAM. I'm trying to work with 1024x1024 double matrices on an 8M-Machine, and
> things have to be thought carefully not to blow up the LRU-paging algorithm.

It's worthwhile to write code that uses memory efficiently.  However,
your code should definately not have to know how much RAM the machine
has.

> 				- Thomas
> 
>    greve AT rs1 DOT thch DOT uni-bonn DOT de
>    unt145 AT dbnrhrz1
--
				Eric Backus
				ericb%hplsla AT hplabs DOT hp DOT com
				(206) 335-2495

- Raw text -


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