caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christian Lindig <lindig@cs.uni-sb.de>
To: Caml List <caml-list@inria.fr>
Subject: [Caml-list] design for ocaml heap profiler
Date: Mon, 23 Feb 2004 11:00:39 +0100	[thread overview]
Message-ID: <2225A9D9-65E7-11D8-B8C7-000A95DDB608@cs.uni-sb.de> (raw)

To complete OCaml's toolbox I'd like to have a heap profiler that 
tracks allocation of memory. As a first step, I'd like to augment each 
heap-allocated block with the address of the instruction that allocated 
it. Then the GC could write out a trace that shows where all the live 
memory comes from.

My first idea was to change the the block-allocation instructions in 
the bytecode interpreter such that they allocate one additional slot  
to hold the current address' instruction:

	#define Alloc_small_hp(b,n,t)  \
     	do{Alloc_small(b,(n)+1,t);Field(b,n)=Val_int(pc);}while(0)

	Use Alloc_small_hp instead of Alloc_small in in interp.c

Only the runtime systems knows about the additional slot and I expected 
the generated code never to touch the new slot. However, it does not 
work, the compiler crashes, and I could not find out why.

A better design would reserve the new slot as part of the header; this 
requires to redefine the macros in mlvalues.h. Has anybody tried to 
enlarge the header? It would be very nice if the header could be 
enlarged by a configurable number n of slots, where n=0 for the 
production runtime system.

I appreciate any advice about how to enlarge heap blocks for run-time 
information.

-- Christian

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


                 reply	other threads:[~2004-02-23 10:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2225A9D9-65E7-11D8-B8C7-000A95DDB608@cs.uni-sb.de \
    --to=lindig@cs.uni-sb.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).