[erlang-questions] reducing size of erlang

Matthias Lang <>
Wed Jul 16 08:02:00 CEST 2008


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?  
...
> :~/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. 



More information about the erlang-questions mailing list