altos/scheme: Use 64-bit ints to track memory allocation stats
authorKeith Packard <keithp@keithp.com>
Mon, 11 Dec 2017 00:50:06 +0000 (16:50 -0800)
committerKeith Packard <keithp@keithp.com>
Mon, 11 Dec 2017 20:20:25 +0000 (12:20 -0800)
These are only collected for debug purposes, but can get quite large
if the interpreter runs for a while.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/scheme/ao_scheme.h
src/scheme/ao_scheme_mem.c
src/scheme/test/ao_scheme_test.c

index 896166174e691036d9b1b7c07ebb4c769ee68fd4..4655b2a988c564ef97d011b3ac61da36c1a74c6e 100644 (file)
@@ -522,9 +522,9 @@ ao_scheme_poly_vector(ao_poly poly)
 
 /* memory functions */
 
-extern int ao_scheme_collects[2];
-extern int ao_scheme_freed[2];
-extern int ao_scheme_loops[2];
+extern uint64_t ao_scheme_collects[2];
+extern uint64_t ao_scheme_freed[2];
+extern uint64_t ao_scheme_loops[2];
 
 /* returns 1 if the object was already marked */
 int
index fe4bc4f548bba562cf2340636f1e67e3933ff240..45d4de98c88c69d094a64feb93c01b48b5758c0a 100644 (file)
@@ -483,9 +483,9 @@ ao_scheme_poly_mark_ref(ao_poly *p, uint8_t do_note_cons)
 }
 
 #if DBG_MEM_STATS
-int ao_scheme_collects[2];
-int ao_scheme_freed[2];
-int ao_scheme_loops[2];
+uint64_t ao_scheme_collects[2];
+uint64_t ao_scheme_freed[2];
+uint64_t ao_scheme_loops[2];
 #endif
 
 int ao_scheme_last_top;
index 686e7169f47f33a4bbfcf5c29dbff17fba4ffcd5..0c77d8d5bde46f3e092cb3b4deea07f95a592479 100644 (file)
@@ -107,15 +107,15 @@ main (int argc, char **argv)
        }
        ao_scheme_read_eval_print();
 
-       printf ("collects: full: %d incremental %d\n",
+       printf ("collects: full: %lu incremental %lu\n",
                ao_scheme_collects[AO_SCHEME_COLLECT_FULL],
                ao_scheme_collects[AO_SCHEME_COLLECT_INCREMENTAL]);
 
-       printf ("freed: full %d incremental %d\n",
+       printf ("freed: full %lu incremental %lu\n",
                ao_scheme_freed[AO_SCHEME_COLLECT_FULL],
                ao_scheme_freed[AO_SCHEME_COLLECT_INCREMENTAL]);
 
-       printf("loops: full %d incremental %d\n",
+       printf("loops: full %lu incremental %lu\n",
                ao_scheme_loops[AO_SCHEME_COLLECT_FULL],
                ao_scheme_loops[AO_SCHEME_COLLECT_INCREMENTAL]);