[erlang-questions] reducing size of erlang

Joe Armstrong erlang@REDACTED
Wed Jul 16 12:22:04 CEST 2008

Stripping erlang to a minimal subset is something I have done
several times. For a long time my goal was under 1.44 MB (= a floppy)
I suspect this is no longer possible.

read (for example)

also google "sae erlang" - for hints and tips on how to do this.

If you start erlang and evaluate code:all_loaded() you'll see which modules
get loaded - then just write a program to fetch all the beam files for
these modules compress them and store them in a single file.

With a little work you should be able to reduce the system to half a dozen files
occupying < 5 MBs - you can also mess around with code.erl to change the
loading mechanism.

/Joe Armstrong

On Wed, Jul 16, 2008 at 8:02 AM, Matthias Lang <matthias@REDACTED> wrote:
> On Tuesday, July 15, Andrew Harris wrote:
>> Thanks for the useful information.  I was able to save around 30MB,
>> going from 70MB to around 40MB!  It fits on the gumstix now.
> If 40MB is good enough for you, great. But you can get much smaller than
> that if you want.
>> I'm wondering if I might not have cross compiled correctly?
> ...
>> root@REDACTED:~/cross-compiled/bin$ ./erl
>> (no error logger present) error: beam/beam_load.c(1097): Error loading
>> module error_handler:
>>   use of opcode 124; this emulator supports only up to 115
> I'll second Anders' diagnosis---it's exactly what happens when you've
> used a newer version of Erlang to compile the beams. The clean way out
> of that is to delete* every copy of erlang on your machine and then
> start again with the R10 tarball. Build it natively once (and install)
> and then, in a fresh directory, do your cross compile.  Then you
> have zero chance of getting confusing things happening.
> You can check that everything went as planned just by looking at the
> .beam file sizes, e.g.
> ~ >ll /usr/local/src/otp_src_R11B-2/lib/stdlib/ebin/string.beam
> ... 10408 ... /usr/local/src/otp_src_R11B-2/lib/stdlib/ebin/string.beam
> ~ >ll /home/matthias/gth1_build/opt/erlang/lib/erlang/lib/stdlib-1.12.8/ebin/string.beam
> .. 2753 /home/matthias/gth1_build/opt/erlang/lib/erlang/lib/stdlib-1.12.8/ebin/string.beam
> So, about 10k for a 'normal' string.beam and about 3k when slimmed.
> Matt
>  * There are less destructive ways of achieving the same thing.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions

fra@REDACTED; ingvar.akesson@REDACTED

[Kopia av detta meddelande skickas till FRA för övervakningsändamål.
De vill ju ändå läsa min e-post.]

[A copy of this mail has been sent to
FRA for monitoring purposes. FRA wants to read all my e-mail and have
been allowed to do by the Swedish parliment - in violation of article
12 of the UN Universal Declaration of Human Rights]

More information about the erlang-questions mailing list