From: Adam Dickmeiss Date: Wed, 13 Dec 2006 15:28:28 +0000 (+0000) Subject: Central point of exit for xmalloc X-Git-Tag: YAZ.2.1.42~9 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=f25338b01de9ab9fb8dcc952b70b7b12b1e71c00 Central point of exit for xmalloc --- diff --git a/src/nmem.c b/src/nmem.c index 5d3b4db..b76c555 100644 --- a/src/nmem.c +++ b/src/nmem.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2006, Index Data ApS * See the file LICENSE for details. * - * $Id: nmem.c,v 1.25 2006-08-11 13:10:27 adam Exp $ + * $Id: nmem.c,v 1.26 2006-12-13 15:28:28 adam Exp $ */ /** @@ -182,7 +182,7 @@ static int nmem_active_no = 0; static int nmem_init_flag = 0; /** \brief whether nmem blocks should be reassigned to heap */ -static int nmem_release_in_heap = 0; +static int nmem_release_in_heap = 1; #if NMEM_DEBUG struct nmem_debug_info { diff --git a/src/xmalloc.c b/src/xmalloc.c index d48daa4..61d2d4f 100644 --- a/src/xmalloc.c +++ b/src/xmalloc.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * All rights reserved. * - * $Id: xmalloc.c,v 1.7 2006-04-21 10:28:07 adam Exp $ + * $Id: xmalloc.c,v 1.8 2006-12-13 15:28:28 adam Exp $ */ /** * \file xmalloc.c @@ -246,6 +246,11 @@ void xmalloc_trav_f(const char *s, const char *file, int line) xmalloc_trav_d(file, line); } +void xmalloc_fatal(void) +{ + exit(1); +} + void *xrealloc_f (void *o, size_t size, const char *file, int line) { void *p = xrealloc_d (o, size, file, line); @@ -263,7 +268,7 @@ void *xrealloc_f (void *o, size_t size, const char *file, int line) { yaz_log (YLOG_FATAL|YLOG_ERRNO, "Out of memory, realloc (%ld bytes)", (long) size); - exit(1); + xmalloc_fatal(); } return p; } @@ -286,7 +291,7 @@ void *xmalloc_f (size_t size, const char *file, int line) { yaz_log (YLOG_FATAL, "Out of memory - malloc (%ld bytes)", (long) size); - exit (1); + xmalloc_fatal(); } return p; } @@ -308,7 +313,7 @@ void *xcalloc_f (size_t nmemb, size_t size, const char *file, int line) { yaz_log (YLOG_FATAL, "Out of memory - calloc (%ld, %ld)", (long) nmemb, (long) size); - exit (1); + xmalloc_fatal(); } return p; }