Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to profile a dart app?

Tags:

profile

dart

I'm trying the demo of start, which is a pretty simple web site built on dart.

When I run it, the initial memory usage is 10M, but when I visit the home page, refresh it again and again, the memory is growing fast until it gets to 78M, and will never get back.

I want to find what uses the memory, and is there any memory leak, but I don't know how to do it. Is it any tool can help me to profile a dart app?

like image 941
Freewind Avatar asked Oct 04 '22 19:10

Freewind


1 Answers

It has already been pointed out in the comments that there are ways to get a CPU profile from the VM on Linux (https://code.google.com/p/dart/wiki/Profiling).

As far as I understand what you are really looking for is to get a heap or memory profile. While it is possible to print an object histogram when the program terminates (see below), we do not have any convenient way to get the object histogram while your server is running. We do hope to be able to add this capability over the next months.

To print the object histogram when the Dart script exits, you should pass the flag --print_object_histogram to the Dart VM. This will print the averages of the live objects at the end of each major GC over the life of the program. This can be fine to get a quick overview, but is not ideal to track down and identify real problems.

like image 57
Ivan Posva Avatar answered Oct 10 '22 19:10

Ivan Posva