Is manual cleanup a best practice for VARIANT and BSTR?

10 views
Skip to first unread message

Markus Karg

unread,
Jan 25, 2024, 9:13:34 AMJan 25
to Java Native Access
SAFEARRAY.ByReference implements AutoClosable (via Closable), so apparently try-with-resources should be used to correctly free its system resources.

VARIANT and BSTR do neither implement AutoClosable nor Closable, but have custom methods like VARIANT.clear() to cleanup manually.

So what is the best practice with VARIANT and BSTR: Freeing their system resources manually, or simply letting the GC / Finanlizer do its job by not doing anything?
Reply all
Reply to author
Forward
0 new messages