Но что прям так плохо будет – не ожидал.
L=lists:seq(1,20000000) – выжирает память как не в себя.
Вот это – тоже весело:
1> L=lists:seq(1,256).
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,
23,24,25,26,27,28,29|...]
2> B=list_to_binary(L).
** exception error: bad argument
in function list_to_binary/1
called as list_to_binary([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,
23,24,25,26,27,28|...])
ну и напоследок:
34> f().
ok
35> L=lists:seq(1,256).
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,
23,24,25,26,27,28,29|...]Crash dump was written to: erl_crash.dump
eheap_alloc: Cannot allocate 1425410620 bytes of memory (of type “heap”).
Aborted
Originally published at U.F.M's Homepage. Please leave any comments there.