Message-ID: From: "davecramer (@davecramer)" To: "pgjdbc/pgjdbc" Date: Thu, 11 Jan 2024 16:20:50 +0000 Subject: Re: [pgjdbc/pgjdbc] issue #3089: Metaspace Memory leak: Thread.inheritedAccessControlContext In-Reply-To: References: List-Id: X-GitHub-Author-Login: davecramer X-GitHub-Comment-Id: 1887513538 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 3089 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3089#issuecomment-1887513538 Content-Type: text/plain; charset=utf-8 So here is what should happen: gc() is called and adds any references that can be cleaned up to the PhantomReferenceQueue. For whatever reason this is not occurring since the queue is empty. However we have added the connections to the linked list so the thread keeps running waiting for either connection.close to be called or gc() to add them to the queue. By. removing that code you are bypassing the second step. I'd be curious how many connections are still open after a reload