caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <xavier.leroy@inria.fr>
To: A Joseph Koshy <koshy@india.hp.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] embedded caml?
Date: Sun, 11 Nov 2001 18:20:55 +0100	[thread overview]
Message-ID: <20011111182055.E16307@pauillac.inria.fr> (raw)
In-Reply-To: <200111080617.LAA12169@postbox.india.hp.com>; from koshy@india.hp.com on Thu, Nov 08, 2001 at 11:47:14AM +0530

> 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


  parent reply	other threads:[~2001-11-11 17:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-08  6:17 A Joseph Koshy
2001-11-08  7:25 ` SooHyoung Oh
2001-11-08 11:30 ` Christopher Quinn
2001-11-11 17:20 ` Xavier Leroy [this message]
2001-11-11 17:43   ` Alwyn Goodloe
2001-11-13 20:26     ` Xavier Leroy
2001-11-15  8:33       ` [Caml-list] [Summary] " A Joseph Koshy

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=20011111182055.E16307@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=koshy@india.hp.com \
    /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;
as well as URLs for NNTP newsgroup(s).