Start here. This is the direct spoken answer to practice first.
Overview
The detail message and deployment evidence determine which memory resource failed and which artifact can explain it.
First I preserve the exact error detail and surrounding service, container, and GC evidence because Java heap space, Metaspace, direct-buffer failure, native thread creation, and an operating-system kill are different incidents. For heap exhaustion, I want a heap dump near failure plus GC and allocation history. For native or process exhaustion, I inspect RSS, thread count, direct memory, container limits, and native-memory evidence. I stabilize the service separately from diagnosing the cause.