[ 
https://issues.apache.org/jira/browse/KAFKA-16687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17845464#comment-17845464
 ] 

Philip Nee commented on KAFKA-16687:
------------------------------------

[~fortherightous] - Not sure if this is what you are seeing:

 
{code:java}
Native Memory Tracking (reserved=3835KB +481KB, committed=3835KB +481KB)
  55                             (malloc=458KB +234KB #6808 +3631)
  56                             (tracking overhead=3376KB +247KB) {code}
and

 
{code:java}
 290 [0x00000001040af538] Unsafe_AllocateMemory0(JNIEnv_*, _jobject*, long)+0xcc
 291 [0x0000000147f01034]
 292                              (malloc=43KB type=Other +43KB #4 +4)
 293
 294 [0x00000001040af538] Unsafe_AllocateMemory0(JNIEnv_*, _jobject*, long)+0xcc
 295 [0x000000014753d8ac]
 296                              (malloc=996KB type=Other -1249KB #94 -102) 
{code}

> Native memory leak by Unsafe_allocatememory  in Kafka Clients  3.7.0
> --------------------------------------------------------------------
>
>                 Key: KAFKA-16687
>                 URL: https://issues.apache.org/jira/browse/KAFKA-16687
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients, consumer
>    Affects Versions: 3.7.0
>            Reporter: FTR
>            Assignee: Philip Nee
>            Priority: Major
>
> I am building a Java Project which using Maven dependency Kafka-clients with 
> 3.7.0 version.
> My Java application logic is to use Kafka Consumer to poll Kakfa broker topic 
>  continuously. 
> I have configured my Java application with JVM options with -Xms8G -Xmx8G  
> -XX:MaxMetaspaceSize=4G, and then run it. 
> Also, there are 16G physical memory on my virtual machine. 
> After my Java application running a long time, I have found that resident 
> memory of the Java Process was being grown to more than 14G.
> In the end, the Java process ate Swap space. 
> I checked it with jmap -heap pid, and found heap memory usage is Ok. 
> Also with Native Memory Tracking [jcmd pid Native.memory detail.diff], I 
> found that it's caused by [NMT Internal] memory,  which created by 
> Unsafe_allocatememory xxx.
> In my Java application, I don't use any NIO DirectByteBuffer to allocate 
> memory.
> And I check it the Kafka-clients source code, it have codes with use 
> "sun.misc.unsafe" to allocate memory.  And MaxMetaspaceSize not work for it . 
>  
> Could you help to check it? How could I to stop this growing native memory to 
> avoid my System hang?  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to