Erlang/OTP Forums

Author Message

<  Erlang bugs mailing list  ~  Strange Memory Allocation Crash

Guest
Posted: Wed Jul 07, 2010 11:28 am Reply with quote
Guest
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
daniel@greyowl:~/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
daniel@greyowl:~/sdb/work/gf_olympus/troy/trunk/tmp> erl --version
Erlang R14A (erts-5.Cool [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 Smile

--
-----
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


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

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

________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org

Post received from mailinglist
Guest
Posted: Wed Jul 07, 2010 12:12 pm Reply with quote
Guest
The error_logger can't consume the info messages you send at the rate
that that tight loop produces them.

erl_crash.dump:
<0.5.0> error_logger Garbing (limited info) 27440736 182452560 7557980

Regards,
Bj
Guest
Posted: Wed Jul 07, 2010 12:16 pm Reply with quote
Guest
On 2010-07-07 14:11, Bj
Guest
Posted: Wed Jul 07, 2010 12:53 pm Reply with quote
Guest
And this of course spins out of control because

do(100.0) -> done;

never matches exactly.

do(N) when N >= 100.0 -> done;

should put an end to the madness.

/Sverker


Bj

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum