[erlang-questions] Understanding memory usage

Erik Søe Sørensen <>
Mon Jan 28 10:49:27 CET 2013


Indeed - you run out of pointer values as well as physical space :-)
So, for that program to work as it is, you need >12GB ram on a 64-bit
machine. If Beam supports such large processes at all.
I think the time is best spent rewriting that seq() call.

2013/1/28 Valentin Micic <>

> Hmmmm… how can anything take 5,7GB in 32-bit architecture?
>
> V/
>
> On 28 Jan 2013, at 10:46 AM, Erik Søe Sørensen wrote:
>
> 2013/1/26 Ward Bekker (TTY) <>
>
>> Hi,
>>
>> I run into high memory usage (>1.5GB) when running `crack_util:crack`
>> from this module: https://gist.github.com/4642789 (make sure crypto is
>> running: `crypto:start()`). As far as I can see, it's not creating (or
>> holding on to)  huge pieces of data.
>>
>> Why is that?
>>
>
> It happens in this line:
> lists:seq(0, Products-1)).
> because
> Products = round(math:pow(length(?CHAR_LIST), TryLength)) = 59^5 =
> 714924299
> lists:seq() is, as anything else in Erlang, calculated eagerly, so you get
> a full representation of the list.
> In a 32-bit Erlang VM, that takes 5,7GB.
>
> You may want to write a function that folds over a range of integers, and
> use that instead of lists:foldl(_,_,lists:seq(A,B)) :-)
>
> /Erik
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130128/108bbf99/attachment.html>


More information about the erlang-questions mailing list