From 3254e8d0ece83a602473b0644e342ebbf42b924d Mon Sep 17 00:00:00 2001 From: miker Date: Sat, 8 Dec 2007 19:29:09 +0000 Subject: [PATCH 1/1] tracking actual list length based on adds and uses git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1161 9efc2488-bf62-4759-914b-345cdb29e865 --- src/libopensrf/osrf_json_object.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libopensrf/osrf_json_object.c b/src/libopensrf/osrf_json_object.c index feb030d..c87d4c5 100644 --- a/src/libopensrf/osrf_json_object.c +++ b/src/libopensrf/osrf_json_object.c @@ -43,6 +43,7 @@ GNU General Public License for more details. static int unusedObjCapture = 0; static int unusedObjRelease = 0; static int mallocObjCreate = 0; +static int currentListLen = 0; union unusedObjUnion{ @@ -81,6 +82,7 @@ jsonObject* jsonNewObject(const char* data) { o = (jsonObject*) freeObjList; freeObjList = freeObjList->next; unusedObjRelease++; + currentListLen--; } else { OSRF_MALLOC( o, sizeof(jsonObject) ); mallocObjCreate++; @@ -168,8 +170,9 @@ void jsonObjectFree( jsonObject* o ) { freeObjList = unused; unusedObjCapture++; + currentListLen++; if (unusedObjCapture > 1 && !(unusedObjCapture % 1000)) - osrfLogDebug( OSRF_LOG_MARK, "Objects malloc()'d: %d, Reusable objects captured: %d, Objects reused: %d", mallocObjCreate, unusedObjCapture, unusedObjRelease ); + osrfLogDebug( OSRF_LOG_MARK, "Objects malloc()'d: %d, Reusable objects captured: %d, Objects reused: %d, Current List Length: %d", mallocObjCreate, unusedObjCapture, unusedObjRelease, currentListLen ); } static void _jsonFreeHashItem(char* key, void* item){ -- 2.43.2