我启动了一个 Dart 程序,似乎存在内存使用问题。我想打开 Observatory进行调查,但未使用 --observe
启动该过程。
有没有办法在不重启进程的情况下启动天文台?
最佳答案
您可以通过向进程发送 SIGQUIT
信号来启动 Observatory。
请参阅 Getting Started with Observatory 的命令行中的独立应用部分:
You can also retroactively enable the VM service for a running process on Linux or Mac by sending the process
SIGQUIT
(perhaps you have a long-running server that started misbehaving and you want to investigate why). The process then displays the port that the VM service is bound to on its stdout.
$ ps ax | grep dart
<pid> pts/61 Sl+ 0:01 dart example.dart
$ kill -s SIGQUIT <pid>
Observatory listening on http://127.0.0.1:<port>
关于debugging - 有没有办法在程序已经启动后打开天文台?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34451390/