You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example below segfaults on roc --version:
roc nightly pre-release, built from commit faeea52 on Fr 23 Aug 2024 09:01:42 UTC
There are no compilation errors of any kind.
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.14.0/dC5ceT962N_4jmoyoffVdphJ_4GlW3YMhAPyGPr-nU0.tar.br" }
import pf.Stdoutimport pf.Taskloop = \i, max ->
if i < max then
i + loop (i +1) max
else
i
main =
x = 1000*1000*1000
z = loop 0 x
# z = List.range {start: At 0, end: Before x} |> List.walk 0 Num.addStdout.line! "Hello, World! $(Num.toStr z)"
The commented out line was the other attempt at computing the same sum, which resulted in OOM kill of the process as it tried to allocate 1 billion element long List. Not sure why, but it was clearly unnecessary here.
changing the loop impl to this makes the thing work correctly, but it is ugly as sin and not obvious for the user to figure out what the problem is.
loop = \sum, i, max ->
if i < max then
loop (sum + i) (i +1) max
else
sum
The text was updated successfully, but these errors were encountered:
Anton-4
changed the title
Improve user experience for large allocations
Improve user experience for big List.range calls
Aug 27, 2024
Relocated from roc-lang/examples#199. issue reported by @alexpyattaev:
The example below segfaults on roc --version:
roc nightly pre-release, built from commit faeea52 on Fr 23 Aug 2024 09:01:42 UTC
There are no compilation errors of any kind.
The commented out line was the other attempt at computing the same sum, which resulted in OOM kill of the process as it tried to allocate 1 billion element long List. Not sure why, but it was clearly unnecessary here.
changing the loop impl to this makes the thing work correctly, but it is ugly as sin and not obvious for the user to figure out what the problem is.
The text was updated successfully, but these errors were encountered: