From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA17074; Sun, 11 Nov 2001 18:24:21 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA16999 for ; Sun, 11 Nov 2001 18:24:20 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id fABHKtn03826; Sun, 11 Nov 2001 18:20:55 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA16904; Sun, 11 Nov 2001 18:20:55 +0100 (MET) Date: Sun, 11 Nov 2001 18:20:55 +0100 From: Xavier Leroy To: A Joseph Koshy Cc: caml-list@inria.fr Subject: Re: [Caml-list] embedded caml? Message-ID: <20011111182055.E16307@pauillac.inria.fr> References: <200111080617.LAA12169@postbox.india.hp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Mailer: Mutt 1.0i In-Reply-To: <200111080617.LAA12169@postbox.india.hp.com>; from koshy@india.hp.com on Thu, Nov 08, 2001 at 11:47:14AM +0530 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > I am trying to get O'Caml to run in an extremely resource constrained > environment. To this end I am interested in getting the O'Caml > program to run in as small a memory footprint as possible (GC induced > latencies are not a problem). > > Today using OCaml 3.02 on FreeBSD 4.3, a simple hello world program > like, >> print_endline "Hello World";; << translates to > > o 8554 bytes of interpreter bytecode, and, The ocaml bytecode linker, like the C linker, eliminates unused compilation units; but as soon as you reference a function from the Pervasives unit (e.g. print_endline), all of Pervasives gets linked in. It is possible to construct a lightweight version of the standard library, and/or bypass its use altogether. With that kind of hacks you could get to less than 1K for "hello world". > o 111945 bytes of executable code (using the -custom switch to > "ocamlc") Same answer. Some of the runtime system services (e.g. marshalling, debugger interface, etc) can be eliminated if you don't need them. However, more than half of these 111K are composed of the bytecode interpreter and the GC / memory manager; you can't eliminate those :-) > I would like to ask if anyone has considered Caml for embedded > applications? I don't think this has been considered much (unless you count as "embedded" the Palm Pilot port of Caml Light that François Rouaix did a while ago). Generally speaking, I think Caml (and especially the Objective Caml implementation) is not really suitable if you don't have a 32-bit processor and at least a few hundred kilobytes of RAM. If your memory constraints are tighter than this, I'm afraid a lower-level language is required. - Xavier Leroy ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr