caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: Garbage collection qustion
@ 1998-07-01  9:26 Damien Doligez
  1998-07-02  8:09 ` Ohad Rodeh
  0 siblings, 1 reply; 4+ messages in thread
From: Damien Doligez @ 1998-07-01  9:26 UTC (permalink / raw)
  To: caml-list


>From: Ohad Rodeh <orodeh@cs.huji.ac.il>

>[allocation: minor=0.0M (4% promoted) (direct major=0K)|collections:
>minor=1, major=0, compact=0|words: 63488 (0% live) (1 chunks)|blocks: 120
>(99% live) (largest_free=62878)]
[...]
>[allocation: minor=2.7M (0% promoted) (direct major=0K)|collections:
>minor=91, major=21, compact=3|words: 63488 (1% live) (1 chunks)|blocks:
>255 (99% live) (largest_free=62343)]

I think you are misinterpreting the numbers.  The relevant variable
here is heap_words, which doesn't increase at all.

Does the size of your process (as reported by ps) actually increase ?

-- Damien





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Garbage collection qustion
  1998-07-01  9:26 Garbage collection qustion Damien Doligez
@ 1998-07-02  8:09 ` Ohad Rodeh
  0 siblings, 0 replies; 4+ messages in thread
From: Ohad Rodeh @ 1998-07-02  8:09 UTC (permalink / raw)
  To: Damien Doligez; +Cc: caml-list



On Wed, 1 Jul 1998, Damien Doligez wrote:

> 
> >From: Ohad Rodeh <orodeh@cs.huji.ac.il>
> 
> >[allocation: minor=0.0M (4% promoted) (direct major=0K)|collections:
> >minor=1, major=0, compact=0|words: 63488 (0% live) (1 chunks)|blocks: 120
> >(99% live) (largest_free=62878)]
> [...]
> >[allocation: minor=2.7M (0% promoted) (direct major=0K)|collections:
> >minor=91, major=21, compact=3|words: 63488 (1% live) (1 chunks)|blocks:
> >255 (99% live) (largest_free=62343)]
> 
> I think you are misinterpreting the numbers.  The relevant variable
> here is heap_words, which doesn't increase at all.
> 
> Does the size of your process (as reported by ps) actually increase ?
> 
> -- Damien
> 
> 
> 
Yes, the heap_words parameter does not increase, niether does (ps) report
an increase in memory use by the processs. However the minor_words and 
major_words parameters increase without bound. This is misleading as these
parameters record the amount of words allocated in the minor and major
heaps respectively. 

	Ohad.
   





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Garbage collection qustion
@ 1998-07-03 14:20 Damien Doligez
  0 siblings, 0 replies; 4+ messages in thread
From: Damien Doligez @ 1998-07-03 14:20 UTC (permalink / raw)
  To: caml-list

>From: Ohad Rodeh <orodeh@cs.huji.ac.il>

>However the minor_words and 
>major_words parameters increase without bound.

The current documentation of these fields is ambiguous.  In future
versions, it will read:

-     [minor_words]  Number of words allocated in the minor heap since
             the program was started.
-     [major_words]  Number of words allocated in the major heap, including
             the promoted words, since the program was started.

I hope this is clearer.

-- Damien





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Garbage collection qustion
@ 1998-06-29  7:51 Ohad Rodeh
  0 siblings, 0 replies; 4+ messages in thread
From: Ohad Rodeh @ 1998-06-29  7:51 UTC (permalink / raw)
  To: Ocaml Mailing List

Hi,
  I have a problem with the Ocaml garbage collector. The included program
allocates memory from the heap and does nothing with it. The heap keeps
growing without bound although memory is not being used and no refrences
to it exist. 

Running the program with the following parameters:
	ttt -nrounds 1000 -status 3 -chunk 10000

Will go through 1000 rounds of allocating a string of size 10000. The
status flag describes how many GC status reports you would like. 

Why does the heap grow without bound? 
	Ohad.
-------------------------------

(*ttt.ml 
*)
open Printf

let nrounds = ref 100
let status = ref 10
let chunk  = ref 1000

(* Status of the heap
*)
let string_list_of_gc_stat s =
  let alloc_promote_pct = (s.Gc.promoted_words * 100) / s.Gc.minor_words in
  let alloc_major_direct = s.Gc.major_words - s.Gc.promoted_words in
  let blocks_total = s.Gc.live_blocks + s.Gc.free_blocks in
  let blocks_live_pct = (s.Gc.live_blocks * 100) / blocks_total in
  let words_live_pct = (s.Gc.live_words * 100) / s.Gc.heap_words in
  [ sprintf "allocation: minor=%.1fM (%d%% promoted) (direct major=%dK)" 
    ((float s.Gc.minor_words) /. 1000000.0) alloc_promote_pct (alloc_major_direct/1000) ;
    sprintf "collections: minor=%d, major=%d, compact=%d" s.Gc.minor_collections s.Gc.major_collections s.Gc.compactions ;
    sprintf "words: %d (%d%% live) (%d chunks)" s.Gc.heap_words words_live_pct s.Gc.heap_chunks ;
    sprintf "blocks: %d (%d%% live) (largest_free=%d)" blocks_total blocks_live_pct s.Gc.largest_free
  ]	

let string_of_list f l   = sprintf "[%s]" (String.concat "|" (List.map f l))

(* Print the heap status?
*)
let chp i =  
	if (i mod (!nrounds / !status) = 0) then (
		let stat = Gc.stat () in
		printf "%s\n" (string_of_list (fun x -> x) (string_list_of_gc_stat stat));
		Gc.minor();
		Gc.major()
	)

let _ = 
 Arg.parse [
	"-nrounds",Arg.Int(fun i -> nrounds := i), "nrounds";
	"-status",Arg.Int(fun i -> status := i), "How may heap status reports";
	"-chunk",Arg.Int(fun i -> chunk := i), "The size of string allocated in each round";
  ] (fun _  -> ()) "perf-crypto";

  let r = Gc.get () in    
	r.Gc.verbose <- true;    
	Gc.set r;

	for i=0 to !nrounds do 
		chp i;
		let cccc = String.create !chunk in ()
	done








^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-07-06 16:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-07-01  9:26 Garbage collection qustion Damien Doligez
1998-07-02  8:09 ` Ohad Rodeh
  -- strict thread matches above, loose matches on Subject: below --
1998-07-03 14:20 Damien Doligez
1998-06-29  7:51 Ohad Rodeh

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).