Indeed - you run out of pointer values as well as physical space :-)<br>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.<br>I think the time is best spent rewriting that seq() call.<br>
<br><div class="gmail_quote">2013/1/28 Valentin Micic <span dir="ltr"><<a href="mailto:valentin@pixie.co.za" target="_blank">valentin@pixie.co.za</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Hmmmm… how can anything take 5,7GB in 32-bit architecture?<div><br></div><div>V/</div><div><br><div><div><div class="h5"><div>On 28 Jan 2013, at 10:46 AM, Erik Søe Sørensen wrote:</div><br>
</div></div><blockquote type="cite"><div><div class="h5">2013/1/26 Ward Bekker (TTY) <span dir="ltr"><<a href="mailto:ward@tty.nl" target="_blank">ward@tty.nl</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div>Hi,</div><div><br></div><div>I run into high memory usage (>1.5GB) when running `crack_util:crack` from this module: <a href="https://gist.github.com/4642789" target="_blank">https://gist.github.com/4642789</a> (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.</div>
<div><br></div><div>Why is that?</div></div></blockquote><div><br></div></div>It happens in this line:<br><div style="margin-left:40px">lists:seq(0, Products-1)).<br></div>because<br><div style="margin-left:40px">Products = round(math:pow(length(?CHAR_LIST), TryLength)) = 59^5 = 714924299<br>
</div>lists:seq() is, as anything else in Erlang, calculated eagerly, so you get a full representation of the list.<br>In a 32-bit Erlang VM, that takes 5,7GB.<br><br>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)) :-)<br>
<br>/Erik<br></div></div>
_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br><a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br></div></div></blockquote></div><br>