MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Critical memory leak with J/Link

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47558] Re: [mg47530] Critical memory leak with J/Link
  • From: "Werner Schuster" <werner.schuster at netway.at>
  • Date: Fri, 16 Apr 2004 05:20:23 -0400 (EDT)
  • References: <200404150739.DAA11638@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

> Memory is not freed with calls to JavaGC[].  It is only freed with
> QuitJava[] or quitting the kernel.

You might want to refer to the "Reference Counts and Memory Management"
section of the J/Link Userguide;

JavaGC[] won't be of much help, if there is still a valid reference
to the Object; in your case, the "g" expression still points to the
MemoryHolder, which in turn still references the large Graph Expression
that you passed in. This is, as far as I see it, correct behaviour
 (Mathematica or J/Link doesn't know that you don't intend to use
the "g" expression/reference anymore, so it keeps it).

You can use either JavaBlock[] (wrap your code inside it) or one
of the Release* Expressions (ReleaseObject[],...) to get rid of the
reference (possibly followed by a JavaGC[] to make sure the GC frees the
memory).

I suppose that should solve your problem (unless I'm missing
something else).


murphee
-- 
Werner Schuster (murphee)
Student of SoftwareEngineering and KnowledgeManagement
Maintainer of the OGO-JOGI Project @ http://ogo-jogi.sourceforge.net/
Blog @ http://jroller.com/page/murphee



  • Prev by Date: Re: Re: When Is Precision[ ] $MachinePrecision, And When Is It Not?
  • Next by Date: Re: Obtaining Standard Errors when using FindMinimum in Mathematica
  • Previous by thread: Critical memory leak with J/Link
  • Next by thread: Re: Critical memory leak with J/Link