From: Guillaume Hennequin <guillaume.hennequin@epfl.ch>
To: Martin Jambon <martin.jambon@ens-lyon.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] let x = ... in object ...
Date: Tue, 26 May 2009 15:06:11 +0200 [thread overview]
Message-ID: <d8e32b760905260606x1c4fed2do1361ff4ae289be6f@mail.gmail.com> (raw)
In-Reply-To: <4A1BE36C.70200@ens-lyon.org>
[-- Attachment #1: Type: text/plain, Size: 812 bytes --]
> # class a = let () = print_endline "hello" in object end;;
> hello
> class a : object end
>
>
> Maybe you mean the following:
>
>
?
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
let mya = () ;;
Gc.full_major () ;;
---------> memory consumption is now 0.1
Furthermore, in a fresh ocaml toplevel,
let x = Array.make_matrix 10000 10000 0. ;;
---------> memory consumption = 39.5
(half of the previous memory usage)
So, it seems that x, although not useful after the object creation, is not
garbage collected.
??
Cheers
Guillaume.
[-- Attachment #2: Type: text/html, Size: 1213 bytes --]
next prev parent reply other threads:[~2009-05-26 13:06 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 [this message]
2009-05-26 13:30 ` Martin Jambon
2009-05-27 1:46 ` Jacques Garrigue
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=d8e32b760905260606x1c4fed2do1361ff4ae289be6f@mail.gmail.com \
--to=guillaume.hennequin@epfl.ch \
--cc=caml-list@inria.fr \
--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