From 3b4cd7837562cd78fe80bde94f5aa6729b2f755d Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 27 May 2015 03:45:30 +0200 Subject: lib: add new extensible memory-type handling This rewrites Quagga's memory per-type allocation counting, without using a fixed global list of types. Instead, source files can declare memory types which get handled through constructor functions called by the dynamic linker during startup. Acked-by: Vincent JARDIN Acked-by: Donald Sharp [DL: v3: forgot "nonnull" attribute on XFREE] Signed-off-by: David Lamparter --- lib/log.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/log.c') diff --git a/lib/log.c b/lib/log.c index 9821483d69..1ecc5b6df6 100644 --- a/lib/log.c +++ b/lib/log.c @@ -680,6 +680,14 @@ _zlog_assert_failed (const char *assertion, const char *file, abort(); } +void +memory_oom (size_t size, const char *name) +{ + zlog_err("out of memory: failed to allocate %zu bytes for %s" + "object", size, name); + zlog_backtrace(LOG_ERR); + abort(); +} /* Open log stream */ struct zlog * -- cgit v1.2.3