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âtre'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âtre. 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., 오전 11:07, Yitzhak Mandelbaum 작성: > > > Kihong, > > > > Could you elaborate on what you mean by "variable sharing" and what > specifically is not happening as expected? Perhaps you could provide 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 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 > > > > > > > > -- > 허 기 홍 드림 > khheo@ropas.snu.ac.kr > 서울대학교 프로그래밍 연구실 > > > > -- > 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 > >