smengcl commented on PR #6455:
URL: https://github.com/apache/ozone/pull/6455#issuecomment-2044209524

   > actually, if output stream simply allocate direct buffer without 
managing/recycling the buffer upon the closure of the output stream itself, 
it's going to run out of memory quite easily.
   
   In theory when a direct buffer is no longer hard-referenced, JVM GC will be 
able to clean the object up (and `free()` the referenced memory) just like 
regular heap buffer.
   
   But, because direct buffer does not count towards JVM heap usage I am not 
sure if JVM still tracks the size of those directly `malloc()`ed memory size. 
And thus unlike heap memory pressure which JVM can sense and trigger GC on 
unused (non-referenced) objects, I am not sure JVM would do the same for direct 
buffer ones. That might explain why it can still get `OutOfMemoryError: Direct 
buffer memory`.
   
   So yes proactively cleaning is better.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to