summaryrefslogtreecommitdiffstats
path: root/maccaml/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'maccaml/memory.c')
-rw-r--r--maccaml/memory.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/maccaml/memory.c b/maccaml/memory.c
new file mode 100644
index 000000000..e62c4c9c1
--- /dev/null
+++ b/maccaml/memory.c
@@ -0,0 +1,29 @@
+/***********************************************************************/
+/* */
+/* Objective Caml */
+/* */
+/* Damien Doligez, projet Para, INRIA Rocquencourt */
+/* */
+/* Copyright 1998 Institut National de Recherche en Informatique et */
+/* en Automatique. Distributed only by permission. */
+/* */
+/***********************************************************************/
+
+/* $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;
+}