1998-10-02 06:02:32 -07:00
|
|
|
/***********************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Objective Caml */
|
|
|
|
/* */
|
|
|
|
/* Damien Doligez, projet Para, INRIA Rocquencourt */
|
|
|
|
/* */
|
|
|
|
/* Copyright 1998 Institut National de Recherche en Informatique et */
|
1999-11-17 10:59:06 -08:00
|
|
|
/* en Automatique. All rights reserved. This file is distributed */
|
2001-12-07 05:41:02 -08:00
|
|
|
/* under the terms of the GNU Library General Public License, with */
|
|
|
|
/* the special exception on linking described in file ../LICENSE. */
|
1998-10-02 06:02:32 -07:00
|
|
|
/* */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
/* Allocate from application memory or from Multifinder memory;
|
|
|
|
always leave at least kMinimumMemory free in application memory.
|
|
|
|
*/
|
|
|
|
OSErr AllocHandle (Size size, Handle *result)
|
|
|
|
{
|
|
|
|
OSErr err;
|
|
|
|
|
|
|
|
if (FreeMem () >= size + kMinimumMemory){
|
|
|
|
*result = NewHandle (size);
|
|
|
|
err = MemError ();
|
|
|
|
}
|
|
|
|
if (err != noErr) *result = TempNewHandle (size, &err);
|
|
|
|
return err;
|
|
|
|
}
|