• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Free memory JNA

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do I free memory of a JNA Structure?


I still get the content of the bigStruct and size even after bigStruct.clear();
Is this the proper way to free memory?
 
Ranch Hand
Posts: 312
MS IE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please add the following line, after line number 8.
 
Aparna Sree
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Madhan for your reply.

We were actually facing a memory leak issue and I couldnt find out a way to free the JNA memory.

Making it null wasn't a great idea because its just making it available for GC. There is no guarantee that it will be garbage collected.

I went through a few links which said the JNA takes care of freeing memory. You do not have to do it explicitly.

http://markmail.org/message/zdn4ah3kdhiqsr4o#query:jna%20freeing%20memory+page:5+mid:qdgdlevoggyghbgk+state:results
http://markmail.org/message/zdn4ah3kdhiqsr4o

Anyhow the issue was not in JNA code it was in native code and we fixed it too JNA works just fine.
reply
    Bookmark Topic Watch Topic
  • New Topic