From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p27AOKl4020641 for ; Mon, 7 Mar 2011 11:24:21 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AswCAA5BdE1KfVK2kGdsb2JhbACEKJNyMYkjhFIIFQEBAQEJCQwHEQQho1WJZAUCglmENYkKAQEDBYRiBXYEjDCDQ3CEJzqBFg X-IronPort-AV: E=Sophos;i="4.62,276,1297033200"; d="vcf'?scan'208";a="101448516" Received: from mail-wy0-f182.google.com ([74.125.82.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 07 Mar 2011 11:24:19 +0100 Received: by wyb32 with SMTP id 32so5930126wyb.27 for ; Mon, 07 Mar 2011 02:24:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:message-id:date:from:user-agent :mime-version:to:subject:references:in-reply-to:x-enigmail-version :content-type; bh=NCkxVkMh4jy8bvLOPnUpfDN73vE8JIxoyl0SmChWHeM=; b=t/5dDzC9pHVKebYhWdsV7ghb9ZrT3h4HPsMYXce/sKFt6VOKARatVHjDRBdPj4Bbyn 3k6F5uQRljibRS8pnhUvgkabZtGzERO4MemmkWRpf8JnyI2+ERuEhW77SfaoG0V0m+lt Sy0vZQ/0xGb8fyJggRZDt3Q8th9UMgklPKOZE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:x-enigmail-version:content-type; b=P3pYTUaAX6ZahrQZHMGTsHxGY8WpYPTu0Mjy2+akHSImoMAWDPMFt+iUroE3G0T5mG y9SCFgrEBAkBAAL3ouI7AAD2msqaGEXM+zHFl5+HWoAWzosrx3gwD5j6/O/Lxk6h/aqN UG7dv8mZA/ZOMgPTg8r+LX1ktLBxMu9+DTk3Y= Received: by 10.227.201.9 with SMTP id ey9mr3367297wbb.41.1299493459522; Mon, 07 Mar 2011 02:24:19 -0800 (PST) Received: from [195.83.212.218] (chercheurs-218.saclay.inria.fr [195.83.212.218]) by mx.google.com with ESMTPS id o6sm2013290wbo.3.2011.03.07.02.24.17 (version=SSLv3 cipher=OTHER); Mon, 07 Mar 2011 02:24:18 -0800 (PST) Sender: Fabrice Le Fessant Message-ID: <4D74B250.7040607@inria.fr> Date: Mon, 07 Mar 2011 11:24:16 +0100 From: Fabrice Le Fessant User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8 MIME-Version: 1.0 To: caml-list@inria.fr References: <1856328280.452099.1299464703924.JavaMail.root@zmbs4.inria.fr> In-Reply-To: <1856328280.452099.1299464703924.JavaMail.root@zmbs4.inria.fr> X-Enigmail-Version: 1.1.2 Content-Type: multipart/mixed; boundary="------------000901010404070600090203" Subject: Re: [Caml-list] variable sharing This is a multi-part message in MIME format. --------------000901010404070600090203 Content-Type: text/plain; charset=EUC-KR Content-Transfer-Encoding: 8bit let a = ... let b = Some a let c = b (* b and c share the same value *) let d = Some a (* d = b, but d != b, i.e. b and d don't share the same value in memory *) If you want b and d to share the same value, you have to use some kind of h-consing, but the runtime won't do it for you by default. --Fabrice INRIA -- OCamlPro On 03/07/2011 03:25 AM, Kihong Heo wrote: > 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. > > Thank you. > Kihong > > 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 > ¼­¿ï´ëÇб³ ÇÁ·Î±×·¡¹Ö ¿¬±¸½Ç > > > --------------000901010404070600090203 Content-Type: text/x-vcard; charset=utf-8; name="fabrice_le_fessant.vcf" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="fabrice_le_fessant.vcf" YmVnaW46dmNhcmQNCmZuOkZhYnJpY2UgTEUgRkVTU0FOVA0KbjpMRSBGRVNT QU5UO0ZhYnJpY2UNCm9yZzpJTlJJQSBTYWNsYXkgLS0gSWxlLWRlLUZyYW5j ZTtQcm9qZXQgT0NhbWxQcm8NCmFkcjtxdW90ZWQtcHJpbnRhYmxlOjs7UGFy YyBPcnNheSBVbml2ZXJzaXQ9QzM9QTkgO09yc2F5IENFREVYOzs5MTg5MztG cmFuY2UNCmVtYWlsO2ludGVybmV0OmZhYnJpY2UubGVfZmVzc2FudEBpbnJp YS5mcg0KdGl0bGU7cXVvdGVkLXByaW50YWJsZTpDaGFyZz1DMz1BOSBkZSBS ZWNoZXJjaGUNCnRlbDt3b3JrOiszMyAxIDc0IDg1IDQyIDE0DQp0ZWw7ZmF4 OiszMyAxIDc0IDg1IDQyIDQ5IA0KdXJsOmh0dHA6Ly9mYWJyaWNlLmxlZmVz c2FudC5uZXQvDQp2ZXJzaW9uOjIuMQ0KZW5kOnZjYXJkDQoNCg== --------------000901010404070600090203--