pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: vlsi (@vlsi) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] issue #3902: createBlob() not closing LargeObject.
Date: Fri, 02 Jan 2026 20:19:59 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

@batman007db , it would be great if you could share the profiling you have.

If you can reproduce the behavior with a simpler example, it would help as well.

---

> profiling in jconsole, the direct memory increases

As far as I understand, it should not be connected with pgjdbc. I do not think pgjdbc uses direct memory at the moment.

---

You could use https://github.com/async-profiler/async-profiler to profile nativememory via `event=nativemem`. See https://github.com/async-profiler/async-profiler/blob/master/docs/ProfilerOptions.md

---

Here we should use try-with-resources for `LargeObject` as well: https://github.com/pgjdbc/pgjdbc/blob/62c9805ef8606f3d38273ac69f64b14e936a0bfa/pgjdbc/src/main/java/...

I think the intention was "ok, we intend to use the blob as prepared statement sometime later.
However, in practice closing the lob (calling `lo_close` API) does not invalidate large object oid, and it just releases a server-side handle.
I guess we should better close the handle anyway as we do not access the lob after we create and populate it.

However, I do not think it would impact "direct memory increases".

---

@batman007db , it would be great if you could try moving `LargeObject` into try as follows (I have not tried it yet, however, it looks safe):

```java
    try (LargeObject lob = lom.open(oid);
         OutputStream outputStream = lob.getOutputStream()) {
```

However, I do not think it would impact your case though.

view thread (6+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://pgjdbc/pgjdbc
  Cc: [email protected], [email protected]
  Subject: Re: [pgjdbc/pgjdbc] issue #3902: createBlob() not closing LargeObject.
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox