[Prev][Next][Index][Thread]

Re: What to do when malloc() returns 0?



On Thu, 21 Jul 1994, Garrett Arch Blythe wrote:
> /*	Function to release spare memory.
>  *	This is really client specific stuff....
>  *	This is only an example.
>  */
> void free_off_some_memory(void)	{
> 	HText *to_be_free;
> 
> 	to_be_free = getOldCachedDoc();
> 
> 	if(to_be_free != NULL)	{
> 		HText_free(to_be_free);
> 	}
> 	else	{
> 		/*	Free other memory if possible here.
> 		 */
> 	}
> }

Sorry,
	The above should have been:

BOOL free_off_some_memory(void)	{
	HText *to_be_free;

	to_be_free = getUnusedCachedDoc();

	if(to_be_free != NULL)	{
		HText_free(to_be_free);
		return(TRUE);
	}
	else	{
		/*	Free other memory if possible here.
		 */
	}

	return(FALSE);
}

Trodden Soil

I am trodden soil.
Dust covers my face.
Soles crush my nature
Revealing a hard empty space.

Garrett Arch Blythe  (913)864-0436
User Services Student Programmer/Consultant
University of Kansas Computer Center
<doslynx@falcon.cc.ukans.edu>


References: