JESS: [EXTERNAL] Question on QueryResult close() function

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

JESS: [EXTERNAL] Question on QueryResult close() function

dselva80
Hi,

I am experiencing a memory leak problem in a Matlab-Jess application and I am trying to locate the leak. I came across the definition of the close() method of the QueryResult class. I have never called this method after using queries. 

1) Should I call close() after using a query?
2) Could not calling close() be the cause of the leak? 

If not, I would appreciate any tips on typical causes of leaks in Matlab-Jess applications. 

Thanks in advance,

Daniel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: JESS: [EXTERNAL] Question on QueryResult close() function

Friedman-Hill, Ernest

Hi Daniel,

 

Closing a QueryResult doesn’t really do anything important; normal garbage collection will free all of its resources.

 

I used Google to see if there was a standard Jess/Matlab integration that I didn’t know about, but I didn’t find one; I’m afraid I don’t know anything about how Jess and Matlab are typically used together. Jess does “warm up” for a few iterations if run repeatedly with the same rules – i.e., “(reset)” won’t necessarily get you back to the same memory usage as before the first run – but this levels off quickly. It would be a good idea to run a heap analyzer tool to see what kind of objects are being leaked; that might give us a clue as to what’s happening.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Daniel Selva
Sent: Thursday, June 27, 2013 12:53 PM
To: jess-users
Subject: JESS: [EXTERNAL] Question on QueryResult close() function

 

Hi,

 

I am experiencing a memory leak problem in a Matlab-Jess application and I am trying to locate the leak. I came across the definition of the close() method of the QueryResult class. I have never called this method after using queries. 

 

1) Should I call close() after using a query?

2) Could not calling close() be the cause of the leak? 

 

If not, I would appreciate any tips on typical causes of leaks in Matlab-Jess applications. 

 

Thanks in advance,


Daniel

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JESS: [EXTERNAL] Question on QueryResult close() function

Peter Lin

Hi Daniel,

How are you measuring the leak?

It is important to look at the heap used and not the total heap allocated to the JVM process. What I've done in the past with JESS is write a function that uses java's runtime class to get actual memory used stats.

        Runtime rt = Runtime.getRuntime();
        long free = rt.freeMemory();
        long total = rt.totalMemory();

If you have concerns about JVM heap getting to big, then set -Xmx to the value you desire. If runtime stats don't help, your only viable option is to use a profiling tool like YourKit, JProbe or some other profiler to track down the leak.

peter


On Fri, Jun 28, 2013 at 9:21 AM, Friedman-Hill, Ernest <[hidden email]> wrote:

Hi Daniel,

 

Closing a QueryResult doesn’t really do anything important; normal garbage collection will free all of its resources.

 

I used Google to see if there was a standard Jess/Matlab integration that I didn’t know about, but I didn’t find one; I’m afraid I don’t know anything about how Jess and Matlab are typically used together. Jess does “warm up” for a few iterations if run repeatedly with the same rules – i.e., “(reset)” won’t necessarily get you back to the same memory usage as before the first run – but this levels off quickly. It would be a good idea to run a heap analyzer tool to see what kind of objects are being leaked; that might give us a clue as to what’s happening.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Daniel Selva
Sent: Thursday, June 27, 2013 12:53 PM
To: jess-users
Subject: JESS: [EXTERNAL] Question on QueryResult close() function

 

Hi,

 

I am experiencing a memory leak problem in a Matlab-Jess application and I am trying to locate the leak. I came across the definition of the close() method of the QueryResult class. I have never called this method after using queries. 

 

1) Should I call close() after using a query?

2) Could not calling close() be the cause of the leak? 

 

If not, I would appreciate any tips on typical causes of leaks in Matlab-Jess applications. 

 

Thanks in advance,


Daniel


Loading...