Skip to content
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

fails to install ianmackenzie/elm-geometry package #33

Closed
decioferreira opened this issue Oct 1, 2024 · 2 comments
Closed

fails to install ianmackenzie/elm-geometry package #33

decioferreira opened this issue Oct 1, 2024 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@decioferreira
Copy link

Runs out of memory when trying to install ianmackenzie/elm-geometry:

% guida init
Compiled in DEBUG mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
Hello! Elm projects always start with an elm.json file. I can create them!

Now you may be wondering, what will be in this file? How do I add Elm files to
my project? How do I see it in the browser? How will my code grow? Do I need
more directories? What about tests? Etc.

Check out <https://elm-lang.org/0.19.1/init> for all the answers!

Knowing all that, would you like me to create an elm.json file now? [Y/n]: 
Okay, I created it. Now read that link!
% guida install ianmackenzie/elm-geometry
Compiled in DEBUG mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
Here is my plan:
  
  Add:
                                       elm/random  1.0.0
                                       ianmackenzie/elm-1d-parameter  1.0.1
                                       ianmackenzie/elm-float-extra  1.1.0
                                       ianmackenzie/elm-geometry  4.0.0
                                       ianmackenzie/elm-interval  3.1.0
                                       ianmackenzie/elm-triangular-mesh  1.1.0
                                       ianmackenzie/elm-units 2.10.0
                                       ianmackenzie/elm-units-interval  3.2.0

Would you like me to update your elm.json accordingly? [Y/n]: 

<--- Last few GCs --->

[52228:0x130008000]   162768 ms: Mark-Compact 4024.7 (4128.4) -> 4004.1 (4128.4) MB, pooled: 6 MB, 2023.67 / 0.00 ms  (average mu = 0.161, current mu = 0.120) allocation failure; scavenge might not succeed
[52228:0x130008000]   165004 ms: Mark-Compact 4019.9 (4128.9) -> 4004.4 (4124.1) MB, pooled: 10 MB, 2224.00 / 0.00 ms  (average mu = 0.086, current mu = 0.005) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

 1: 0x102241270 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
 2: 0x10241ca40 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
 3: 0x1025f3b30 v8::internal::Heap::stack() [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
 4: 0x102607cc4 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags)::$_7::operator()() const [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
 5: 0x10260757c void heap::base::Stack::SetMarkerAndCallbackImpl<v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags)::$_7>(heap::base::Stack*, void*, void const*) [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
 6: 0x102e3cd20 PushAllRegistersAndIterateStack [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
 7: 0x1025f1ef4 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
 8: 0x1025e7484 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
 9: 0x1025e7cb0 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
10: 0x1025caca8 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
11: 0x1029bfbd4 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
12: 0x102f3dc74 Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
13: 0x109528404 
14: 0x109948c78 
15: 0x109528678 
16: 0x1099483c0 
17: 0x109948c10 
18: 0x109949050 
19: 0x109528678 
20: 0x1099484d0 
21: 0x109948e54 
22: 0x109948f5c 
23: 0x109538614 
24: 0x109537a14 
25: 0x109234388 
26: 0x10922575c 
27: 0x109a0ba98 
28: 0x1094f3ab0 
29: 0x109a4b130 
30: 0x102ea6c0c Builtins_JSEntryTrampoline [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
31: 0x102ea68f4 Builtins_JSEntry [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
32: 0x10254c864 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
33: 0x10254bddc v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
34: 0x102432c7c v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
35: 0x1021e1058 node::Environment::RunTimers(uv_timer_s*) [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
36: 0x102e82a80 uv__run_timers [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
37: 0x102e862f4 uv_run [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
38: 0x10216246c node::SpinEventLoopInternal(node::Environment*) [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
39: 0x102285d80 node::NodeMainInstance::Run(node::ExitCode*, node::Environment*) [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
40: 0x102285b18 node::NodeMainInstance::Run() [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
41: 0x102207750 node::Start(int, char**) [/Users/decio/.nvm/versions/node/v22.8.0/bin/node]
42: 0x18027c274 start [/usr/lib/dyld]
zsh: abort      guida install ianmackenzie/elm-geometry
@decioferreira decioferreira added the bug Something isn't working label Oct 1, 2024
@decioferreira decioferreira added this to the v1.0 milestone Oct 1, 2024
@decioferreira
Copy link
Author

A workaround for this problem is to add --max-old-space-size=8192 flag to the node call on bin/index.js

decioferreira added a commit that referenced this issue Dec 8, 2024
The main change here revolved around the re-implementation of the IO
monad, allowing for the removal of the need for the top level decoder.

As part of this work we had to move some of the data structures from
modules like `Compiler.Type.UnionFind`, `Compiler.Type.Type` and
`Compiler.Elm.ModuleName` into the IO monad modules, so that we can have
them directly referred on the `RealWorld` record (before we had to use
`Decode.Value` because otherwise we would create import cycles).

This also:
- seems to have solved #33
- partially addresses #10
- greatly improved performance (relates to #37)

The improvement on performance was the following (from `~56:58.46` to
`~2:28.32`):

Before:
```
% time guida make --optimize --output=bin/guida.js src/Terminal/Main.elm 
Starting downloads...

  ● andre-dietrich/parser-combinators 4.1.0
  ● elm/time 1.0.0
  ● elm/json 1.1.3
  ● pilatch/flip 1.0.0
  ● elm/virtual-dom 1.0.3
  ● elm/regex 1.0.0
  ● elm/random 1.0.0
  ● elm/bytes 1.0.8
  ● fredcy/elm-parseint 2.0.1
  ● dasch/levenshtein 1.0.3
  ● rtfeldman/elm-hex 1.0.0
  ● elm/parser 1.1.0
  ● the-sett/elm-pretty-printer 3.1.0
  ● elm-community/basics-extra 4.1.0
  ● elm/url 1.0.0
  ● elm-community/array-extra 2.6.0
  ● elm-community/list-extra 8.7.0
  ● elm-community/maybe-extra 5.3.0
  ● obiloud/numeric-decimal 3.0.1
  ● elm/core 1.0.5
  ● zwilias/elm-rosetree 1.5.0
  ● guida-lang/graph 1.0.0
  ● guida-lang/glsl 1.0.0
  ● elm/html 1.0.0
  ● elm-explorations/test 2.2.0

Dependencies ready!           
Success! Compiled 132 modules.

    Terminal.Main ───> bin/guida.js

guida make --optimize --output=bin/guida.js src/Terminal/Main.elm  3666.89s user 249.74s system 114% cpu 56:58.46 total
```

After:
```
% time guida make --optimize --output=bin/guida.js src/Terminal/Main.elm
Starting downloads...

  ● andre-dietrich/parser-combinators 4.1.0
  ● elm/time 1.0.0
  ● elm/bytes 1.0.8
  ● elm/regex 1.0.0
  ● elm/virtual-dom 1.0.3
  ● elm/random 1.0.0
  ● the-sett/elm-pretty-printer 3.1.0
  ● rtfeldman/elm-hex 1.0.0
  ● fredcy/elm-parseint 2.0.1
  ● elm/html 1.0.0
  ● elm/json 1.1.3
  ● dasch/levenshtein 1.0.3
  ● elm-community/list-extra 8.7.0
  ● elm/url 1.0.0
  ● elm/core 1.0.5
  ● pilatch/flip 1.0.0
  ● elm-community/array-extra 2.6.0
  ● elm-community/basics-extra 4.1.0
  ● elm-community/maybe-extra 5.3.0
  ● guida-lang/graph 1.0.0
  ● guida-lang/glsl 1.0.0
  ● zwilias/elm-rosetree 1.5.0
  ● elm/parser 1.1.0
  ● obiloud/numeric-decimal 3.0.1
  ● elm-explorations/test 2.2.0

Dependencies ready!           
Success! Compiled 141 modules.

    Terminal.Main ───> bin/guida.js

guida make --optimize --output=bin/guida.js src/Terminal/Main.elm  157.99s user 2.57s system 108% cpu 2:28.32 total
```
@decioferreira
Copy link
Author

fixed by #48

decioferreira added a commit that referenced this issue Dec 8, 2024
The main change here revolved around the re-implementation of the IO
monad, allowing for the removal of the need for the top level decoder.

As part of this work we had to move some of the data structures from
modules like `Compiler.Type.UnionFind`, `Compiler.Type.Type` and
`Compiler.Elm.ModuleName` into the IO monad modules, so that we can have
them directly referred on the `RealWorld` record (before we had to use
`Decode.Value` because otherwise we would create import cycles).

This also:
- seems to have solved #33
- partially addresses #10
- greatly improved performance (relates to #37)

The improvement on performance was the following (from `~56:58.46` to
`~2:28.32`):

Before:
```
% time guida make --optimize --output=bin/guida.js src/Terminal/Main.elm
Starting downloads...

  ● andre-dietrich/parser-combinators 4.1.0
  ● elm/time 1.0.0
  ● elm/json 1.1.3
  ● pilatch/flip 1.0.0
  ● elm/virtual-dom 1.0.3
  ● elm/regex 1.0.0
  ● elm/random 1.0.0
  ● elm/bytes 1.0.8
  ● fredcy/elm-parseint 2.0.1
  ● dasch/levenshtein 1.0.3
  ● rtfeldman/elm-hex 1.0.0
  ● elm/parser 1.1.0
  ● the-sett/elm-pretty-printer 3.1.0
  ● elm-community/basics-extra 4.1.0
  ● elm/url 1.0.0
  ● elm-community/array-extra 2.6.0
  ● elm-community/list-extra 8.7.0
  ● elm-community/maybe-extra 5.3.0
  ● obiloud/numeric-decimal 3.0.1
  ● elm/core 1.0.5
  ● zwilias/elm-rosetree 1.5.0
  ● guida-lang/graph 1.0.0
  ● guida-lang/glsl 1.0.0
  ● elm/html 1.0.0
  ● elm-explorations/test 2.2.0

Dependencies ready!
Success! Compiled 132 modules.

    Terminal.Main ───> bin/guida.js

guida make --optimize --output=bin/guida.js src/Terminal/Main.elm  3666.89s user 249.74s system 114% cpu 56:58.46 total
```

After:
```
% time guida make --optimize --output=bin/guida.js src/Terminal/Main.elm
Starting downloads...

  ● andre-dietrich/parser-combinators 4.1.0
  ● elm/time 1.0.0
  ● elm/bytes 1.0.8
  ● elm/regex 1.0.0
  ● elm/virtual-dom 1.0.3
  ● elm/random 1.0.0
  ● the-sett/elm-pretty-printer 3.1.0
  ● rtfeldman/elm-hex 1.0.0
  ● fredcy/elm-parseint 2.0.1
  ● elm/html 1.0.0
  ● elm/json 1.1.3
  ● dasch/levenshtein 1.0.3
  ● elm-community/list-extra 8.7.0
  ● elm/url 1.0.0
  ● elm/core 1.0.5
  ● pilatch/flip 1.0.0
  ● elm-community/array-extra 2.6.0
  ● elm-community/basics-extra 4.1.0
  ● elm-community/maybe-extra 5.3.0
  ● guida-lang/graph 1.0.0
  ● guida-lang/glsl 1.0.0
  ● zwilias/elm-rosetree 1.5.0
  ● elm/parser 1.1.0
  ● obiloud/numeric-decimal 3.0.1
  ● elm-explorations/test 2.2.0

Dependencies ready!
Success! Compiled 141 modules.

    Terminal.Main ───> bin/guida.js

guida make --optimize --output=bin/guida.js src/Terminal/Main.elm  157.99s user 2.57s system 108% cpu 2:28.32 total
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant