Browse thread
let x = ... in object ...
-
Guillaume Hennequin
-
Martin Jambon
-
Guillaume Hennequin
- Martin Jambon
- Jacques Garrigue
-
Guillaume Hennequin
-
Martin Jambon
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2009-05-27 (01:46) |
From: | Jacques Garrigue <garrigue@m...> |
Subject: | Re: [Caml-list] let x = ... in object ... |
From: Guillaume Hennequin <guillaume.hennequin@epfl.ch> > well, I have just tested this in the toplevel > > class a n = > let x = Array.make_matrix n n 0. in > object(self) > val y = Array.init n (fun i -> Array.copy x.(i)) > method y = y > end ;; > > let mya = new a 10000 ;; > > ---------> memory consumption 78.5 (from top) > > Gc.full_major () ;; > > ---------> memory consumption is still 78.9 Try with class a n = let x = Array.make_matrix n n 0. in object(self) val y = Array.init n (fun i -> Array.fold_left (+) 0. x.(i)) method y = y end ;; After the gc, x is collected. What you are seeing is the size taken by y. Jacques Garrigue