Why is Dart going very slowly after a while?

We have some problems with Darth. It looks like after a while the garbage collector won't be able to clean up the memory in the VM, so the application hangs. Anyone with this problem? Are there memory limits?

+3


source to share


2 answers


You should reuse your objects instead of creating new ones. You have to use the pooling pattern:

http://en.wikipedia.org/wiki/Object_pool_pattern

Take care of the canvas and its proper destruction.



Other GC efficiency papers:

http://blog.tojicode.com/2012/03/javascript-memory-optimization-and.html

http://qt-project.org/doc/qt-5/qtquick-performance.html

+2


source


Are there memory limits?

Yes. Dart seems to be running at maximum sizes that can be configured at launch time:

(The following applies to all garbage-collected languages ​​...)



If your application starts out of place (that is, the heap is slowly feeding objects that the GC cannot remove), you may run into an unpleasant situation where the GC runs more and more often with less and less memory each time. Eventually you ran out of memory, but before that the application becomes very slow.

A solution typically does one or both of the following:

  • Find what's causing your memory shortage. Generally, you don't select too many objects. Rather, the typical reason is that unwanted objects are still available ... via some data structure generated by your application.

  • Set the "quick death" option for the GC .... if available. For example, Java garbage collectors can be configured to measure garbage collection times. (GC overhead). When the GC overhead exceeds a preset ratio, the Java VM throws OutOfMemoryError

    to "pull the plug."

+2


source







All Articles