koka-lang / koka

Koka language compiler and interpreter

Home Page:http://koka-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory Leak using VSCode with koka v3.0.1 for macos-arm64

louy2 opened this issue · comments

Trying to learn koka but this is preventing me completely.

With koka v3.0.1 for macos-arm64, and this code:

fun test_03_if1()
  val bigger = fn(x, y) if y < x then x else y
  bigger(1, 2).show.println

Hover to get signature hangs at "Loading..." and koka-v3.0.1 quickly grows to use >20GB of memory, slowing down the entire machine.

Possibly related #438

If this is 438, what causes the extension to trigger an infinite loop of reloads then? A simple hello world is spared from this leaking behavior.

Actually this is related to the typechecking bug: #446 , #437. The problem is that y < x looks for a compare signature that is fully polymorphic, which causes an infinite loop.

For now you can fix it by doing this

fun test_03_if1()
  val bigger = fn(x:int, y:int) if y < x then x else y
  bigger(1, 2).show.println

On the dev branch the root cause of the infinite loop is fixed. (As is mentioned in the linked issues).
Maybe I can get Daan to release a version quickly with the fix, since it is showing up in a lot of issues.

However, I do know that he is currently revamping the Module system / compilation pipeline which should hopefully make progress on #438, and allow us to build modules in parallel & surface errors from all files in the workspace for the language server, here is the issue to track for that work though he'll probably deviate from my proposal a bit #432.