Hi Jeremy,
There are several non-standard functions that may help.
On 26/04/2012 17:06, Jeremy Singer wrote:
Hi David,
I am trying to create something like Hans Boehm's GC benchmark - http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_bench.html in SML. My current attempt is at: http://pastebin.com/2RW9jpCJ
Sorry - I forgot all my ML years ago. Here are some things I'm not sure how to do nicely in Poly/ML:
- printf without lots of String.concat
I don't know about that. Does anyone else have any ideas?
- is there a runtime API call to get the totalMem (current heap
size?) and the free mem (currently unused blocks in heap?)
Poly/ML in SVN has a facility to get quite a lot of internal statistics. Use PolyML.Statistics.getLocalStats to get statistics for the current process or PolyML.Statistics.getRemoteStats to get statistics for another Poly/ML by pid. Note: it seems that this structure is only included if you rebuild the compiler with "make compiler" after "make".
- Are all my ephemeral objects being created properly, or is the
compiler optimizing away their allocation? How could I tell? * So far, I have been checking gc activity with --debug gc flag. Are there any more powerful tools for GC profiling/checking?
PolyML.objSize will show the number of words being used by a data structure. Be careful that if you have any function closures in the data structure it can include everything reachable from the function which could be more than you expect.
One further complication: as part of the great Poly/ML storage management rebuild in SVN there's now a pass that tries to merge identical immutable data structures to reduce the live data size; like PolyML.shareCommonData but only on a single element per pass. It's not enabled by default because it's expensive in CPU time, currently it requires --gcshare 1, but the idea is to enable it when memory is short.
Regards, David