<div dir="ltr"><div dir="ltr"><div>> If all you really need is heap dumps then aren't there other ways to get</div>> those via the management API (that you are already using)?<div><br></div><div>As Alan pointed out, for the direct memory OOME case, the timing of triggering the heap dump is difficult without HeapDumpOnOutOfMemoryError.</div><div>If the direct memory API offers a callback that executes a user-provided function on each allocation or before throwing OOME, that would be easier for user code to trigger a heap dump before OOME.</div><div>However, supporting HeapDumpOnOutOfMemoryError and related flags seems much easier than modifying the direct memory API.<br></div><div><br></div><div>> I really do not want to turn these VM flags into an exported API for use</div>> by JDK code if it can be avoided (they are crude and basic and minimally<br>> tested). If that kind of functionality is needed then I'd prefer to see<br>> a JDK-side API to provide it in a cleaner, more supported way.<div><br></div><div>Even if we provide a JDK-side API (like the callback idea mentioned above), I suppose the API would not respect HeapDumpOnOutOfMemoryError and related JVM flags?</div><div>As Alan (and [~stuefe] and [~xliu] from JDK-8257790) mentioned, those JVM flags are well-known and users would expect them to work when they need to debug these real resource-exhaustion OOMEs.</div><div><br></div><div>For the "crude and basic and minimally tested" argument, I don't think it is a reason to not support them for these useful cases. These OOME flags are extremely widely used in our production jobs (and possibly also for SAP and Amazon). I'm confident the community will help maintain these flags and make sure they function as expected.</div><div><br></div></div><div dir="ltr"><div><div><div dir="ltr" data-smartmail="gmail_signature"><div dir="ltr">-Man</div></div></div><br></div></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><br></div></div></div>