Open eseidelGoogle opened 5 years ago
I can recommend Process Explorer where you can get a lot more details about each process (e.g. command line parameters): https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer
I ran into this again today while doing some local server development. If you ever leak a dart process, you just have to kill all your Dart processes, because you can't tell which is which. :/ It seems we do support this on Mac at least, there I see "dart:flutter.snapshot" as the name in Activity Monitor, which is helpful. FYI @kevmoo @clarkezone
To be clear, I'm not at all sure this is possible on windows. Other things I found while investigating: https://stackoverflow.com/questions/23783985/set-child-process-name-in-windows https://github.com/dvarrazzo/py-setproctitle
One thing we may do here is ship a dart bug
command - a tool to help gather some SDK setup and diagnostic info; that would likely include stats on Dart process (though may not include process IDs). Here's some potential output:
Memory | CPU | Elapsed time | Command line |
---|---|---|---|
75 MB | 0.0% | 00:04 | dart devtools --machine --try-ports 10 --allow-embedding |
792 MB | 0.0% | 17:52:09 | dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.52.1 |
588 MB | 207.9% | 00:04 | dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.52.1 |
A tool that could tell me what the dart processes were on my machine would be awesome (even if I couldn't used the OS ones, although that OS ones would be preferred where possible). Maybe someone has already written a dartps
package or similar, that does sound possible to do...
Windows executables can have a file section for application resources and that contains the version information for the program, including its display name and info. This information is used by Task Manager and the Properties panel when displaying information on a executable file.
I compiled @timsneath tetris example as a win32 app with dart compile exe
and added a resource section with the following version info.
1 VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEOS 0x40004
FILETYPE 0x1
{
BLOCK "StringFileInfo"
{
BLOCK "000004B0"
{
VALUE "FileVersion", "1.0.0.0"
VALUE "ProductVersion", "1.0.0.0"
VALUE "OriginalFilename", "tetris.exe"
VALUE "InternalName", "tetris.exe"
VALUE "FileDescription", "My Awesome Tetris App"
VALUE "CompanyName", " "
VALUE "LegalCopyright", "Copyright (c) 2022"
VALUE "ProductName", " "
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x0000 0x04B0
}
}
And Task Manager shows this:
You can use the the BeginUpdateResource
/UpdateResource
/EndUpdateResource
APIs to make these changes. The data used in UpdateResource is the compiled script from the above. Microsoft Resource Compiler takes the script and outputs the data with a little header. The format of the raw resource data is spec'd but I forget where.
Ref:
Additionally from my understanding there is no runtime way of altering the displayed titles, as, Task Manager opens and memory maps in the executable files into memory to process them and read their resources.
However there is a trick 🤔 If your application has a window it will show its title. You might be able to create an off-screen window or something. Quite hacky 😢
When we get reports of
dart
taking up too much memory, it would be nice to know which dart:https://github.com/flutter/flutter/issues/33862#issuecomment-507174340
Maybe there are other, better ways than changing the process name? FYI @devoncarew