On Thu, 4 Feb 2021 23:23:41 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:

>> Thanks for the thorough list, I have tested most of them but not all. I will 
>> cover them and update here later.
>> 
>>> So really there are two implementations of heap dumping, one in the VM and 
>>> one in SA, but a total of 5 ways to get to them. I'm just starting to get 
>>> my head wrapped around all this myself. We've created a very confusing 
>>> situation for us, and unfortunately I think some of the changes that got us 
>>> here was driven by a goal to simply things.
>> 
>> Yes, it makes me even curious about why there can be two different 
>> implementation of them (one by C++ and one by Java),  it seems we need 
>> double the work of adding new options for those tools, like parallal for 
>> jmap histo and dump, etc.
>
> One implementation is in the JVM itself, to be used when the JVM is still 
> running well, and not just from command line tools. Heap dumping can also be 
> triggered by the JVM itslef by setting flags like -XX:+HeapDumpBeforeFullGC. 
> The other implementation is in SA, to be used on a core file or a hung JVM 
> process, although it can also be used on a JVM that is still running well. 
> BTW, there used to be a 3rd implementation. The old hprof profiler (a JVMTI 
> agent) also was used to generate hprof files.

Hi Lin,

A week ago you replied that you are accepting the following suggested 
refactoring:

                   /*
                    * Possible commands:
                    *     dumpheap gz=1 file
                    *     dumpheap gz=1
                    *     dumpheap file
                    *     dumpheap
                    *
                    * Use default filename if cntTokens == 0.
                    * Handle cases with cntTokens == 1 or 2.
                    */

                    if (cntTokens > 2) {
                        err.println("Too big number of options: " + cntTokens);
                        usage();
                        return;
                    }
                    if (cntTokens >= 1) { // parse first argument which is 
"gz=" option
                        String option  = t.nextToken();
                        gzlevel = parseHeapDumpCompressionLevel(option);
                        if (gzlevel == 0) {
                            usage();
                            return;
                        }
                        filename = "heap.bin.gz";
                    }
                    if (cntTokens == 2) { // parse second argument which is 
filename
                        filename = t.nextToken();
                        if (filename.startsWith("gz=")) {
                            err.println("Filename should not start with "gz=": 
" + filename);
                            usage();
                            return;
                        }
                    }

But I still do not see it in the latest updates from you. It feels like there 
is some misunderstanding and confusion.
Could you, please, clear this up?

Thanks,
Serguei

-------------

PR: https://git.openjdk.java.net/jdk/pull/1712

Reply via email to