2 messages in net.java.dev.jna.users[jna-users] Native memory management ...
FromSent OnAttachments
Buckel, WolfgangDec 19, 2008 6:13 am 
Timothy WallDec 19, 2008 7:58 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[jna-users] Native memory management model of JNA?Actions...
From:Buckel, Wolfgang (wolf@siemens.com)
Date:Dec 19, 2008 6:13:39 am
List:net.java.dev.jna.users

Hello,

I tried out JNA with one of our DLLs and it worked pretty well. Thanks for the
good work. However, I was wondering under which conditions JNA objects like Structure or
primitive arrays take ownership of a block of native memory and consequently
free that block of memory when GCed.

I could find this mail thread in the archives : <https://jna.dev.java.net/servlets/ReadMsg?listName=users&msgNo=1777>
https://jna.dev.java.net/servlets/ReadMsg?listName=users&msgNo=1777

That still does not fully answer my questions: - Does JNA free memory returned by functions (e.g. MyStruct* getNewStruct() )? - How does it work with Struct* arguments passed into a Callback? Does JNA
assume that this memory will be freed by the caller?

- How are the assumptions in general about who is responsible for freeing which
memory?

With best regards, Wolfgang Buckel

Siemens AG Industry Sector Mobility Division Traffic Solutions Research & Development I MO TS R&D SE Hofmannstr. 51 81379 Munich, Germany Tel.: +49 (89) 722-22370 Fax: +49 (89) 722-44477 Mobile: +49 (172) 8421190 <mailto:wolf@siemens.com> mailto:wolf@siemens.com

Siemens Aktiengesellschaft: Chairman of the Supervisory Board: Gerhard Cromme;
Managing Board: Peter Loescher, Chairman, President and Chief Executive Officer;
Wolfgang Dehen, Heinrich Hiesinger, Joe Kaeser, Barbara Kux, Hermann Requardt,
Siegfried Russwurm, Peter Y. Solmssen; Registered offices: Berlin and Munich,
Germany; Commercial registries: Berlin Charlottenburg, HRB 12300, Munich, HRB
6684; WEEE-Reg.-No. DE 23691322

Important notice: This e-mail and any attachment thereof contain corporate
proprietary information. If you have received it by mistake, please notify us
immediately by reply e-mail and delete this e-mail and its attachments from your
system. Thank you.