Comments (13)
Does it do that immediately? Or does it take it a while?
from alive.
from alive.
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.
from alive.
If you watch the sbcl process in top or something, when does the memory start to spike?
from alive.
from alive.
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.
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.
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.
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.
#169 should be fixed by the behaviour I described in the comment above as well.
from alive.
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.
Thanks for taking the time to explain, @nobody-famous, this exchange has been very educational for me.
from alive.
Related Issues (20)
- Nothing Works
- full-width character breaks syntax highlighting HOT 1
- `(if (y-or-n-p) () ())` breaks code formatting HOT 1
- strange warning "bug" HOT 2
- why isn't the repl a repl? HOT 1
- How to suppress warnings HOT 2
- TIME macro not working HOT 1
- lsp-server crashes on drakma http request HOT 4
- Infinite loops break extension HOT 1
- Can't start on MacOS HOT 2
- Features like "retry" are not working in interactive debugger (windows) HOT 1
- function name does not get syntax highlighting and jump to definition not working HOT 3
- syntax highlighting for `+variable-name+` HOT 2
- (in-package :foo) not honored HOT 2
- Suggestion: Make package display tree more nested
- Why chose the language identifier `lisp` over `commonlisp` HOT 2
- Suggestions: Breakpoints HOT 2
- Switch to REPL without using the mouse HOT 4
- upload extension to the Open VSX registry HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alive.