From 3db371abb8a6c764323b932aad9d1d5e6bb36808 Mon Sep 17 00:00:00 2001 From: miker Date: Sat, 8 Dec 2007 19:09:57 +0000 Subject: [PATCH] track malloc()-created objects git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1160 9efc2488-bf62-4759-914b-345cdb29e865 --- src/libopensrf/osrf_json_object.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libopensrf/osrf_json_object.c b/src/libopensrf/osrf_json_object.c index 6b2e0ad..feb030d 100644 --- a/src/libopensrf/osrf_json_object.c +++ b/src/libopensrf/osrf_json_object.c @@ -42,6 +42,7 @@ GNU General Public License for more details. static int unusedObjCapture = 0; static int unusedObjRelease = 0; +static int mallocObjCreate = 0; union unusedObjUnion{ @@ -80,9 +81,10 @@ jsonObject* jsonNewObject(const char* data) { o = (jsonObject*) freeObjList; freeObjList = freeObjList->next; unusedObjRelease++; - } - else + } else { OSRF_MALLOC( o, sizeof(jsonObject) ); + mallocObjCreate++; + } o->size = 0; o->classname = NULL; @@ -167,7 +169,7 @@ void jsonObjectFree( jsonObject* o ) { unusedObjCapture++; if (unusedObjCapture > 1 && !(unusedObjCapture % 1000)) - osrfLogDebug( OSRF_LOG_MARK, "Reusable objects captured: %d, Objects reused: %d", unusedObjCapture, unusedObjRelease ); + osrfLogDebug( OSRF_LOG_MARK, "Objects malloc()'d: %d, Reusable objects captured: %d, Objects reused: %d", mallocObjCreate, unusedObjCapture, unusedObjRelease ); } static void _jsonFreeHashItem(char* key, void* item){ -- 2.11.0