All those memory reports internally use ##process-statistics to get the information.

The source code of ##process-statistics should give you a good idea of the fields:

...
      ___F64VECTORSET(result,___FIX(0),user)
      ___F64VECTORSET(result,___FIX(1),sys)
      ___F64VECTORSET(result,___FIX(2),real)
      ___F64VECTORSET(result,___FIX(3),___GSTATE->gc_user_time)
      ___F64VECTORSET(result,___FIX(4),___GSTATE->gc_sys_time)
      ___F64VECTORSET(result,___FIX(5),___GSTATE->gc_real_time)
      ___F64VECTORSET(result,___FIX(6),___GSTATE->nb_gcs)
      ___F64VECTORSET(result,___FIX(7),___bytes_allocated ())
      ___F64VECTORSET(result,___FIX(8),(2*(1+2)<<___LWS))
      ___F64VECTORSET(result,___FIX(9),n)
      ___F64VECTORSET(result,___FIX(10),minflt)
      ___F64VECTORSET(result,___FIX(11),majflt)
      ___F64VECTORSET(result,___FIX(12),___GSTATE->last_gc_user_time)
      ___F64VECTORSET(result,___FIX(13),___GSTATE->last_gc_sys_time)
      ___F64VECTORSET(result,___FIX(14),___GSTATE->last_gc_real_time)
      ___F64VECTORSET(result,___FIX(15),___GSTATE->last_gc_heap_size)
      ___F64VECTORSET(result,___FIX(16),___GSTATE->last_gc_alloc)
      ___F64VECTORSET(result,___FIX(17),___GSTATE->last_gc_live)
      ___F64VECTORSET(result,___FIX(18),___GSTATE->last_gc_movable)
      ___F64VECTORSET(result,___FIX(19),___GSTATE->last_gc_nonmovable)
...


On Tue, Oct 29, 2013 at 4:41 AM, Jussi Piitulainen <jpiitula@ling.helsinki.fi> wrote:
Dear list,

is there a way to monitor Gambit's memory usage inside a program? I
know about the documented (gc-report-set! #t) and the apparently
undocumented (##gc), but I don't seem to get access to that report,
and I was unable to find other ways to access such information.

This is where I gave up (in gsi v4.6.7):

> (parameterize ((current-error-port (current-output-port)))
     (with-output-to-string '() ##gc))
*** GC: 1 ms, 427K alloc, 1.08M heap, 48.9K live (4% 26056+24056)
""

That is, the ##gc report bypasses current-error-port and I only get to
see the report on the screen.

I'm trying to get some empirical evidence that a certain API does not
leak memory. Those ##gc reports might be adequate on the Gambit side
as is, but I would still like to know if there is some way to access
this information inside the test program. Any pointers?

_______________________________________________
Gambit-list mailing list
Gambit-list@iro.umontreal.ca
https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list