We are working on an automated system for memory performance monitoring.
We start Chrome with proper flags --trace-gc --trace-gc-verbose
both on Windows7 and MacOSX High Sierra.
The output is printed and visible on the console. However capturing the output with standard stream redirection does not work:
What do we do:
MacOS X:
./Google\ Chrome --js-flags="--trace-gc --trace-gc-verbose" > log.txt 2>&1
Windows:
chrome --no-sandbox --js-flags="--trace_gc --trace_gc_verbose" > log.txt 2>&1
What gets written into the log file is only a part of what you can see on the screen: all gc-related data is missing in the file although abundant in the terminal window (you can see all the data when you run the app without stream capture at all).
We suppose a new process for V8 is run and it's output is not directed to stdout, though somewhat it gets printed to the console itself.
The V8 C++ code shows no mark of such a strange redirect, pretty clean standard code, in fact one can record gc-output of node --trace-gc script.js
without any problem with standard stdout/stderr. It seems Chrome adds the undesired behavior.
Question how to record Chrome gc-related data to a file both on Windows and MacOS X.
Partial, unacceptable solution on POSIX-based systems we can grab all the terminal output with script
command. The dump contains all the data we need, but the solution does not cover Windows scenario (we do need tests on Windows) and in fact it does not solve the problem neither explains the reason behind the lacking data, it simply hides the problem away.