From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p27AdxEE021916 for ; Mon, 7 Mar 2011 11:39:59 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aj4CAApFdE3RVdg2kGdsb2JhbACEKJNyhjYBh28IFQEBAQEJCQwHEQQho1GJazyCHYQ7L4hbAQEDBYRndgSBbYpDiFo6gwk X-IronPort-AV: E=Sophos;i="4.62,276,1297033200"; d="scan'208";a="77262171" Received: from mail-qw0-f54.google.com ([209.85.216.54]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 07 Mar 2011 11:39:33 +0100 Received: by qwj8 with SMTP id 8so4426931qwj.27 for ; Mon, 07 Mar 2011 02:39:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=owmBnwCXpp2roCsiwp3o6lDwexTPnwibtj1rwfMSS10=; b=v37hGoTRqaTQhCuSpnuJmzWW1KnQQvmOJXiNFHCgZ7dXtd/Mt+V5FR27LgQPBMNrPv e7g2Byjt52fT0hQA3gV7DWGgjld2GXcmzyNXvXxcaz7uvVG9pWRjhTiPdP+Wv6swbGd7 Iurx64ostPq0Q33rRgDJlUv9UBPYGWDDPyhoY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=LGTXPom0nZYnBypvgQH5F68J85lM4HJ/6VWyKRzB0hdm3RYx98mpJLaPmtL9NOARF1 UU4t7e0ODf78UvlIatJfmg0andRit5FS2XEoN73lcrRxSuAfeZYXf033WrgfK2Yexyjt 1ZJgwoXXnjUO5t14qNwx6wVDo1IapjFAWtZpE= MIME-Version: 1.0 Received: by 10.229.137.85 with SMTP id v21mr2663740qct.164.1299494370477; Mon, 07 Mar 2011 02:39:30 -0800 (PST) Received: by 10.229.74.15 with HTTP; Mon, 7 Mar 2011 02:39:30 -0800 (PST) In-Reply-To: References: Date: Mon, 7 Mar 2011 11:39:30 +0100 Message-ID: From: Julien Signoles To: Kihong Heo Cc: Yitzhak Mandelbaum , caml-list@inria.fr Content-Type: multipart/alternative; boundary=00235452e9605705d0049de21c1a Subject: Re: [Caml-list] variable sharing --00235452e9605705d0049de21c1a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello, 2011/3/7 Kihong Heo > Sorry. It's my mistake. > not variable sharing, but "value sharing" which means alias. > > For example, there is a big set and I want to make many subset of it. > In my thought, if the aliases are made efficiently, the memory explosion > does not make sense. > I don't know exactly what's the problem (my programming style, data type, > or it is a natural result, etc..). > So I want to know the principle. > As Daniel and Fabrice said, I guess you need hash-consing. You may use the Filli=C3=A2tre's Hashcons/Hset/Hmap modules ( http://www.lri.fr/~filliatr/software.en.html) described in [1]. If you want to know details about interaction between hashconsing and ocaml (especially its GC), [2] may be of some interest to you. [1] Sylvain Conchon and Jean-Christophe Filli=C3=A2tre. Type-Safe Modular Hash-Consing. ML Workshop'06. [2] Pascal Cuoq and Damien Doligez, Hashconsing in an incrementally garbage-collected system: a story of weak pointers and hashconsing in ocaml 3.10.2. ML Workshop'08. Hope this helps, Julien > 2011. 3. 7., =EC=98=A4=EC=A0=84 11:07, Yitzhak Mandelbaum =EC=9E=91=EC=84= =B1: > > > Kihong, > > > > Could you elaborate on what you mean by "variable sharing" and what > specifically is not happening as expected? Perhaps you could provide a sm= all > example that demonstrates the problem you're seeing? > > > > Cheers, > > Yitzhak > > > > > > On Mar 6, 2011, at 8:49 PM, Kihong Heo wrote: > > > >> Dear caml-list. > >> > >> I want to know how ocaml compiler make variable sharing. > >> I believe the compiler do good job, but sometime memory consumption > >> of my program does not make sense. > >> So I am curious about what the compiler did or how to make program > memory efficiently. > >> > >> If you know some good notes or web pages for that issue, please let me > know. > >> > >> Thank you. > >> > >> - Kihong Heo > >> > >> -- > >> Caml-list mailing list. Subscription management and archives: > >> https://sympa-roc.inria.fr/wws/info/caml-list > >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > >> Bug reports: http://caml.inria.fr/bin/caml-bugs > >> > > > > ----------------------------- > > Yitzhak Mandelbaum > > > > > > > > -- > =ED=97=88 =EA=B8=B0 =ED=99=8D =EB=93=9C=EB=A6=BC > khheo@ropas.snu.ac.kr > =EC=84=9C=EC=9A=B8=EB=8C=80=ED=95=99=EA=B5=90 =ED=94=84=EB=A1=9C=EA=B7=B8= =EB=9E=98=EB=B0=8D =EC=97=B0=EA=B5=AC=EC=8B=A4 > > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > > --00235452e9605705d0049de21c1a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello,

2011/3/7 Kihong Heo <khheo@ropas.snu.ac.kr&= gt;
Sorry. It's my mistake.
not variable sharing, but "value sharing" which means alias.

For example, there is a big set and I want to make many subset of it.
In my thought, if the aliases are made efficiently, the memory explosion do= es not make sense.
I don't know exactly what's the problem (my programming style, data= type, or it is a natural result, etc..).
So I want to know the principle.

As Daniel and Fab= rice said, I guess you need hash-consing. You may use the Filli=C3=A2tre= 9;s Hashcons/Hset/Hmap modules (http://www.lri.fr/~filliatr/software.en.html) described i= n [1]. If you want to know details about interaction between hashconsing an= d ocaml (especially its GC), [2] may be of some interest to you.

[1] Sylvain Conchon and Jean-Christophe Filli=C3=A2tre. Type-Safe Modular Hash-Consing. ML Workshop'06.
[2] Pascal Cuoq and= Damien Doligez, Hashconsing in an incrementally garbage-collected system: = a story of weak pointers and hashconsing in ocaml 3.10.2. ML Workshop'0= 8.

Hope this helps,
Julien

=C2=A0
2011. 3. 7., =EC=98=A4=EC=A0=84 11:07, Yitzhak Mandelbaum =EC=9E=91=EC=84= =B1:

> Kihong,
>
> Could you elaborate on what you mean by "variable sharing" a= nd what specifically is not happening as expected? Perhaps you could provid= e a small example that demonstrates the problem you're seeing?
>
> Cheers,
> Yitzhak
>
>
> On Mar 6, 2011, at 8:49 PM, Kihong Heo wrote:
>
>> Dear caml-list.
>>
>> I want to know how ocaml compiler make variable sharing.
>> I believe the compiler do good job, but sometime memory consumptio= n
>> of my program does not make sense.
>> So I am curious about what the compiler did or how to make program= memory efficiently.
>>
>> If you know some good notes or web pages for that issue, please le= t me know.
>>
>> Thank you.
>>
>> - Kihong Heo
>>
>> --
>> Caml-list mailing list. =C2=A0Subscription management and archives= :
>> https://sympa-roc.inria.fr/wws/info/caml-list
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginner= s
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>>
>
> -----------------------------
> Yitzhak Mandelbaum
>
>
>

--
=ED=97=88 =EA=B8=B0 =ED=99=8D =EB=93=9C=EB=A6=BC
khheo@ropas.snu.ac.kr
=EC=84=9C=EC=9A=B8=EB=8C=80=ED=95=99=EA=B5=90 =ED=94=84=EB=A1=9C=EA=B7=B8= =EB=9E=98=EB=B0=8D =EC=97=B0=EA=B5=AC=EC=8B=A4



--
Caml-list mailing list. =C2=A0Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


--00235452e9605705d0049de21c1a--