GithubHelp home page GithubHelp logo

Comments (13)

nobody-famous avatar nobody-famous commented on July 20, 2024

Does it do that immediately? Or does it take it a while?

from alive.

ab-10 avatar ab-10 commented on July 20, 2024

from alive.

nobody-famous avatar nobody-famous commented on July 20, 2024

OK, that's weird. I'll have to look into it and see if maybe there's some loop that's getting out of hand. Not sure what it would be filling up the heap with.

from alive.

ab-10 avatar ab-10 commented on July 20, 2024

from alive.

nobody-famous avatar nobody-famous commented on July 20, 2024

If you watch the sbcl process in top or something, when does the memory start to spike?

from alive.

ab-10 avatar ab-10 commented on July 20, 2024

from alive.

nobody-famous avatar nobody-famous commented on July 20, 2024

OK, that actually makes more sense. My current theory is that my parser has a bug that's causing it to get stuck and try to create an infinitely long token. I've found one bug already, but it caused a failure so that wasn't it.

In the output panel, if you switch it to the 'Alive Client' log, how far does it get? That log shows the communication between the server and VSCode. Oh, you may have to put "lisp.trace.server": "verbose" in your settings.

If you open a different lisp file does it still do it?

from alive.

ab-10 avatar ab-10 commented on July 20, 2024

Here's the Alive Client log

If you open a different lisp file does it still do it?

Just realized that it does not. Here are the contents of the file causing the problem:

defmacro fib! (x)
        `(if (<= ,x 2)
             1
             (+ (fib! (- ,x 1))
                (fib! (- ,x 2)))))

(fib! 6)
(macroexpand-1  `(fib! 5))

from alive.

nobody-famous avatar nobody-famous commented on July 20, 2024

Oh, the joys of lisp...

OK, the problem is the (fib! 6) line. In order to get diagnostics, the extension asks sbcl to compile the file without loading it so that it doesn't execute everything. Apparently, when it compiles a macro it tries to fully expand it. In this case, that causes infinite expansion and it eventually blows up. The same thing happens if I run sbcl from the command line and do (compile-file "fib.lisp"). Here's the fun part, it doesn't do that if it loads the file instead of compiling it. With your code, if I comment out that line then nothing breaks. If I then run (fib! 6) from the repl, it works fine.

I might need to put in an option to turn off automatic diagnostics. I've been hoping to avoid that, but it might not be avoidable. I know emacs doesn't do diagnostics as you type because of this.

from alive.

ab-10 avatar ab-10 commented on July 20, 2024

I'm not sure whether this is a byproduct of automatic diagnosis, but if I (manually) compile the same defun in sly, it throws an error when SBCL runs out of heap memory and then gracefully recovers (do let me know if you'd like more info on sly behaviour here). IMO, the ideal behaviour for Alive would be the same. I can imagine it being more tricky in automatic diagnosis use-case. What do you think about such direction?

from alive.

ab-10 avatar ab-10 commented on July 20, 2024

#169 should be fixed by the behaviour I described in the comment above as well.

from alive.

nobody-famous avatar nobody-famous commented on July 20, 2024

Alive does the same thing if you manually compile the file, it goes into the debugger and has an option to abort the thread. I'll hopefully have time this weekend to play around with it. Hopefully there's a specific out of memory error that it's using. The auto diagnostics can't use the debugger because it popping up over and over gets very annoying, very quickly. Calling a restart programmatically aborts the compiler and no further errors/warnings are shown, which isn't ideal. If it has a more specific error that can be caught, then aborting the compiler would be fine. I can still see wanting an option to turn it off because it's going to spike the CPU every time it runs.

I don't think it would help with the other issue, which is the repl getting stuck in an infinite loop. The only options there are to programmatically kill the thread, which can take forever because the CPU is maxed, or kill and restart the repl. Since the LSP is the repl, that's done by reloading the window.

from alive.

ab-10 avatar ab-10 commented on July 20, 2024

Thanks for taking the time to explain, @nobody-famous, this exchange has been very educational for me.

from alive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.