From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: guillaume.hennequin@epfl.ch
Cc: martin.jambon@ens-lyon.org, caml-list@inria.fr
Subject: Re: [Caml-list] let x = ... in object ...
Date: Wed, 27 May 2009 10:46:24 +0900 (JST) [thread overview]
Message-ID: <20090527.104624.238257994.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <d8e32b760905260606x1c4fed2do1361ff4ae289be6f@mail.gmail.com>
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
prev parent reply other threads:[~2009-05-27 1:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-26 12:20 Guillaume Hennequin
2009-05-26 12:41 ` [Caml-list] " Martin Jambon
2009-05-26 13:06 ` Guillaume Hennequin
2009-05-26 13:30 ` Martin Jambon
2009-05-27 1:46 ` Jacques Garrigue [this message]
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=20090527.104624.238257994.garrigue@math.nagoya-u.ac.jp \
--to=garrigue@math.nagoya-u.ac.jp \
--cc=caml-list@inria.fr \
--cc=guillaume.hennequin@epfl.ch \
--cc=martin.jambon@ens-lyon.org \
/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