Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BridJ] Memory leak in VARIANT even in basic use? #389

@ErwinBellon

Description

@ErwinBellon

I am looking for memory leaks in a COM application using an own IMallocSpy implementation (difficult to isolate in a small test application) and suspect VARIANT to leak.

If I track following code:

Pointer pVariant = allocate(VARIANT.class);
pVariant.get().setValue("some string");
pVariant.release();

I get following information about the creation of a memory block that subsequently was never freed:

Memory block at address xxx size16 [size is 16 independent from which string was inserted]
org.bridj.cpp.com.OLEAutomationLibrary.VariantChangeType(Native Method) -2
org.bridj.cpp.com.COMRuntime.change(COMRuntime.java:358) 358
org.bridj.cpp.com.COMRuntime.setValue(COMRuntime.java:389) 389
org.bridj.cpp.com.VARIANT.setValue(VARIANT.java:1119) 1119

I should be using BridJ 6.0.2 on a Windows 7 64 bits OS but in a 32 bit Java environment.

Any hint on how to better use VARIANT was welcome - maybe I should call some other method to properly release the memory. I actually just use VARIANT to get a string from a property bag.

Thanks,

Erwin

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions