aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/malloc.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-09-28 21:25:20 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-09-28 21:25:20 +0000
commitddd06f537235203ce3e9f7a2a5e454410317995c (patch)
treec312f5f6a11f323dc9f8d70c8f1604219de561bb /libgo/runtime/malloc.h
parente78410bf1198e3ce4a37678c991821359b0fde79 (diff)
downloadgcc-ddd06f537235203ce3e9f7a2a5e454410317995c.zip
gcc-ddd06f537235203ce3e9f7a2a5e454410317995c.tar.gz
gcc-ddd06f537235203ce3e9f7a2a5e454410317995c.tar.bz2
runtime: Better detection of memory allocation request overflow.
From-SVN: r191841
Diffstat (limited to 'libgo/runtime/malloc.h')
-rw-r--r--libgo/runtime/malloc.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libgo/runtime/malloc.h b/libgo/runtime/malloc.h
index 16bb449..96cb609 100644
--- a/libgo/runtime/malloc.h
+++ b/libgo/runtime/malloc.h
@@ -128,6 +128,15 @@ enum
MaxGcproc = 4,
};
+// Maximum memory allocation size, a hint for callers.
+// This must be a #define instead of an enum because it
+// is so large.
+#if __SIZEOF_POINTER__ == 8
+#define MaxMem (16ULL<<30) /* 16 GB */
+#else
+#define MaxMem ((uintptr)-1)
+#endif
+
// A generic linked list of blocks. (Typically the block is bigger than sizeof(MLink).)
struct MLink
{