'while' loop consumes up to 2 GB of RAM
See original GitHub issueAfter iterating 30-60 000 times when running the AskScript program (below) node
process consumed up to 2GB of RAM.
let a = 1
while(a>0) {
if ((a/1000):equals(floor(a/1000))) {
log(a)
}
a=a+1
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Python : Memory consumption accumulating in a while loop
Line 95 of the code consumes ~30M of RAM as per the memory_profiler output. It's as if each iteration consumes 30M ending u...
Read more >PC uses 2GB of RAM while idle.
That's normal. Windows caches a lot of data and can sit there with even more ram usage. 6GB RAM installed is a reasonable...
Read more >How is the memory used increasing by using an infinite loop?
A plain infinite loop consumes CPU cycles, not increasing amounts of memory. If you have a process with an infinite loop, and its...
Read more >How to Write Memory Efficient Loops in Python
Very simple but not memory efficient. Putting 500 images with (1000 x 1000) np.float64 pixels takes about 4 GB of memory, which at...
Read more >Double Your Google Colab RAM in 10 Seconds Using a ...
OK, four words. But the important thing is, you don't need to worry about the Python version (Colab has both Python 2 and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cpelican , good catch. After I submitted this error, mhagmajer reduced the allowed operation limit to just 10 000 operations (which is roughly around 600 iterations of a while loop, if I recall correctly), so no longer is it reproducible but if you changed the limit in https://github.com/xFAANG/askql/blob/master/src/askvm/index.ts#L20 to let’s say 10 000 000, you should be able to reproduce.
Seems like
while
will only be able to return the final value anyway @czerwinskilukasz1, https://github.com/xFAANG/askql/issues/239