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
VM: Do GC when idle. #16521
Comments
Try adding a --verbose-gc flag to the dart command line. It seems that no GC happens during the delay, probably because nothing happens at all. The VM is waiting patiently for the next event, and isn't using the time to do GCs. Try doing something during the wait, just small stuff every 10 ms, like: Is it still hanging onto the value in that case? Added NeedsInfo label. |
This comment was originally written by @tomaskulich The timer (as you suggested) does not help. However, if I increased the amount of memory allocated in the 'tick' and therefore forcing Mark-Sweep(full), this helps. This explains a lot, however, this behavior is rather confusing; I would expect VM to drop all the memory it does not need, if it has enough time to do it. Now I have to add the funny ticker to all my profiling code :) |
Setting this as a request for the VM to GC when it has nothing better to do. Removed Type-Defect label. |
I have noticed that in our server code, we hit this problem often. When the server is idle, it does not GC at all until we make a request to the server, which makes it need to GC. With all the idle time, it only makes sense to GC. I'm not an expert though, there is probably a logical argument for not as well. |
This issue was originally filed by @tomaskulich
The following code seems to memory leak:
main(){
String longString = (new List.filled(1000, 'a')).join('');
return new Future.sync((){
var j=0;
var l=[];
for(int i=0; i<1000000; i++){
print(j++);
l.add(longString+'$i');
}
}).then((_){
return new Future.delayed(new Duration(minutes: 10), (){});
});
}
I would expect that during the 10 minutes waiting, the 'l' variable will be freed since it cannot be accessed from the delayed future's computation method; however, this does not happen. Or am I just missing something?
Tried with Dart VM 1.1.1 on ArchLinux
The text was updated successfully, but these errors were encountered: