[Opensrf-commits] r1160 - trunk/src/libopensrf

svn at svn.open-ils.org svn at svn.open-ils.org
Sat Dec 8 14:30:02 EST 2007


Author: miker
Date: 2007-12-08 14:09:57 -0500 (Sat, 08 Dec 2007)
New Revision: 1160

Modified:
   trunk/src/libopensrf/osrf_json_object.c
Log:
track malloc()-created objects

Modified: trunk/src/libopensrf/osrf_json_object.c
===================================================================
--- trunk/src/libopensrf/osrf_json_object.c	2007-12-08 19:03:52 UTC (rev 1159)
+++ trunk/src/libopensrf/osrf_json_object.c	2007-12-08 19:09:57 UTC (rev 1160)
@@ -42,6 +42,7 @@
 
 static int unusedObjCapture = 0;
 static int unusedObjRelease = 0;
+static int mallocObjCreate = 0;
 
 union unusedObjUnion{
 
@@ -80,9 +81,10 @@
 		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 @@
 
     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){



More information about the opensrf-commits mailing list