Strange Memory Allocation Crash

tech <>
Wed Jul 7 13:27:29 CEST 2010



While try to do a quick check on which floats need to be rounded before 
trunking them to get valid results, I was able to crash the Erlang VM.  I find 
it a bit strange as it happened rather quickly into something that I thought 
shouldn't be that intensive.  I have tried this twice, and was wondering if 
this could be pointing to something else as a problem.

Machine Info
:~/sdb/work/gf_olympus/troy/trunk/tmp> uname -a
Linux greyowl 2.6.31.12-0.2-default #1 SMP 2010-03-16 21:25:39 +0100 x86_64 
x86_64 x86_64 GNU/Linux
:~/sdb/work/gf_olympus/troy/trunk/tmp> erl --version
Erlang R14A (erts-5.8) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] 
[hipe] [kernel-poll:false]


============== CODE START

-module(itest).
-export([do/0]).

do() ->
    do(0.0).

do(100.0) ->
    done;
do(Value) ->
    if trunc(Value * 100) =:= trunc(round(Value * 100)) ->
	    do(Value + 0.01);
       true ->
	    error_logger:info_msg("Value: ~p~n", [Value]),
	    do(Value + 0.01)
    end.

============== CODE END

The final result.  (After 280 iterations of the function the following crash)

=INFO REPORT==== 7-Jul-2010::11:33:07 ===
Value: 2.7999999999999843

Crash dump was written to: erl_crash.dump
eheap_alloc: Cannot allocate 20672 bytes of memory (of type "heap").
Aborted


The code is attached

I am a bit at a loss as to where to start troubleshooting this :)

-- 
-----
Mobile : +27 84 468 3138
Skype : danielschutte
Office : +27 (0) 11 475 - 1654
             +27 (0) 11 475 - 1664
             +27 (0) 11 475 - 1674
             +27 (0) 11 475 - 1639


-------------------------------------------------------

-------------------------------------------------------


More information about the erlang-bugs mailing list