question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why DirectMemory In Java Heap ?

See original GitHub issue

I use a code without release like OutOfDirectMemoryError

when Stress test it by jmeter and see it by Jconsole.

image

this is a DirectMemoryError, why Heap is full and directMemory is empty?

Netty version

4.1.65

JVM version (e.g. java -version)

❯ java -version
java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
chrisvestcommented, Dec 7, 2021

Netty has its own memory accounting. What you see from the JMX beans is the accounting done by the JVM, but that only takes the DirectByteBuffer instances into account. In Netty, when Unsafe is available, we allocate direct memory with it, and those allocations are not counted by the JVM.

0reactions
normanmaurercommented, Feb 4, 2022

Closing this for now

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the purpose to use direct memory in Java?
Direct memory was introduced since java 1.4.
Read more >
Memory management
Direct memory, which is part of the Java process heap, is separate from the object heap allocated by -Xmx . The value allocated...
Read more >
Troubleshooting OutOfMemoryError: Direct buffer memory
As we said, the Direct Buffers are allocated to native memory space outside of the JVM's established heap/perm gens. If this memory space ......
Read more >
Understanding the JVM Memory Model — Heap vs. Non-Heap
Memory allocated inside the stack can only be accessed within the thread's context, making it safer — no other threads can access it....
Read more >
Understanding Java Buffer Pool Memory Space - FusionReactor
A direct buffer is a chunk of native memory shared with Java from which you can perform a direct read. An instance of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found