From aff948779920bacf2b36e17314b318b17fd669ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Fri, 8 Sep 2000 22:13:25 +0200 Subject: [PATCH] Added a fatal if attempting to malloc more than 24MB memory in one go. Rev: src/pike_memory.c:1.85 --- src/pike_memory.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pike_memory.c b/src/pike_memory.c index 8dcc836b1f..939917aad7 100644 --- a/src/pike_memory.c +++ b/src/pike_memory.c @@ -10,7 +10,7 @@ #include "pike_macros.h" #include "gc.h" -RCSID("$Id: pike_memory.c,v 1.84 2000/09/08 17:31:03 hubbe Exp $"); +RCSID("$Id: pike_memory.c,v 1.85 2000/09/08 20:13:25 grubba Exp $"); /* strdup() is used by several modules, so let's provide it */ #ifndef HAVE_STRDUP @@ -1396,6 +1396,10 @@ void *debug_malloc(size_t s, LOCATION location) mt_lock(&debug_malloc_mutex); + if (s & 0xff000000) { + fatal("malloc(0x%08lx) -- Huge malloc!\n", (unsigned long)s); + } + m=(char *)malloc(s + DEBUG_MALLOC_PAD*2); if(m) { -- GitLab