New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List literal with many items leads to "Maximum call stack size exceeded" #840

Closed
witoldsz opened this Issue Feb 24, 2017 · 6 comments

Comments

Projects
None yet
3 participants
@witoldsz

witoldsz commented Feb 24, 2017

I just discovered that list literals with many items produce a code which crashes at run-time.
Look at this example: https://runelm.io/c/yca
It defines a list with 1000 items and the program will crash before it executes. Sometimes 400 items will be enough to crash the browser, sometimes 600 won't crash.

I have found this when I was trying to work with elm-community/elm-time library. The bug was filled:
elm-community/elm-time#13
Example: https://ellie-app.com/qwD8mkg9TTa1/1

Later, I have found another, unrelated issue with that lib:
elm-community/elm-time#21
and when I was trying to fix that, I have discovered I cannot even build that project, because it was crashing with Maximum call stack size exceeded during elm-test.

There is no hard limit: that very lib defines dict with all possible time zones which is c.a. 600 elements. It sometimes crashes, sometimes it does not, depends on browser and number of opened tabs.

@process-bot

This comment has been minimized.

Show comment
Hide comment
@process-bot

process-bot Feb 24, 2017

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

process-bot commented Feb 24, 2017

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@witoldsz

This comment has been minimized.

Show comment
Hide comment
@witoldsz

witoldsz Feb 25, 2017

Workaround: split your big list and use List.concat, example:

before =
    [1,2,3,, n]

after =
    List.concat [ [1,2,3,], [ 31, 32, 33,],] ]

witoldsz commented Feb 25, 2017

Workaround: split your big list and use List.concat, example:

before =
    [1,2,3,, n]

after =
    List.concat [ [1,2,3,], [ 31, 32, 33,],] ]
@jvoigtlaender

This comment has been minimized.

Show comment
Hide comment
@jvoigtlaender

jvoigtlaender Feb 25, 2017

Contributor

Thisis a duplicate of a known issue: elm/compiler#1521

Please close.

Contributor

jvoigtlaender commented Feb 25, 2017

Thisis a duplicate of a known issue: elm/compiler#1521

Please close.

@witoldsz

This comment has been minimized.

Show comment
Hide comment
@witoldsz

witoldsz Feb 25, 2017

That's strange, I was looking for an open issue with "maximum" and did not find it.

witoldsz commented Feb 25, 2017

That's strange, I was looking for an open issue with "maximum" and did not find it.

@witoldsz witoldsz closed this Feb 25, 2017

@jvoigtlaender

This comment has been minimized.

Show comment
Hide comment
@jvoigtlaender

jvoigtlaender Feb 25, 2017

Contributor

Looked in the wrong repository?

Contributor

jvoigtlaender commented Feb 25, 2017

Looked in the wrong repository?

@witoldsz

This comment has been minimized.

Show comment
Hide comment
@witoldsz

witoldsz Feb 25, 2017

You are right! I was looking in elm-core.

witoldsz commented Feb 25, 2017

You are right! I was looking in elm-core.

oldfartdeveloper referenced this issue in elm-community/elm-time Mar 1, 2017

Merge pull request #22 from witoldsz/list_concat
elm-lang/core#840 workaround issue #13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment