wood burning stoves 2.0*
The moose likes JSF and the fly likes Memory Leak issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Memory Leak issue" Watch "Memory Leak issue" New topic
Author

Memory Leak issue

Viswas majrekar
Greenhorn

Joined: Dec 20, 2008
Posts: 5
Hi Eveyone,

Can you please give me solution for this issue,

In my application i used Tomcat, JSF framework, Hibernate, MySQL.

In JSF RichFramework and Myfaces

I am rendering values lot of places.

Some times queries also triggering twise.

We are getting memory leak issues in the application, because of this application also very slow.

So please any one guide me how can i solve this issue.

Waiting for reply.
Daniel Jabonete
Ranch Hand

Joined: Apr 01, 2007
Posts: 76
you need to do a profiling for your application to identified the bottleneck.

this way, it will give you an idea of where, and what causing the problems.

cheers!
Viswas majrekar
Greenhorn

Joined: Dec 20, 2008
Posts: 5
Thanks for your reply....

Can you suggest me any one best profiler...

If you have any URL with you, can you please share with me...

If possible explain the steps

Thanks
Daniel Jabonete
Ranch Hand

Joined: Apr 01, 2007
Posts: 76
Hi,

The profiling tools depends in your IDE.

Netbeans has its own profiling, might want ot check out the NetBeans website for the instructions.

Eclipse also has a lot of profiling tools plugins, might want to checkout the particular plugin that might suites you.

Cheers!
Viswas majrekar
Greenhorn

Joined: Dec 20, 2008
Posts: 5
Thanks once again..

I am rendering values in lot of places.

for that i am using <a4j:commandbutton>'s and for rendering(reRender attribute).

Actually what i observed is here query is executing more than one time..

how can i restrict this?

Thanks in advance
Rajneesh Kumar Rajput
Ranch Hand

Joined: Feb 25, 2009
Posts: 39
Hold the records, of the query, possible in the List by defining a variable in the page bean.
Now, in the getter of this variable just add a null check to verify that call the query method if list is not initialized.

private List<O> records;

public List<O> getRecords (){
if(records == null){
records = /call the query method.
}
}

Actually, my faces table calls value attribute twice in Apply Request and Update Model phase. The above will solve your problem.
Also, in order to refresh records you need to again set records = null in the actions of buttons so that new data will be picked after the action.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15957
    
  19

Rajneesh Kumar Rajput wrote:Hold the records, of the query, possible in the List by defining a variable in the page bean.
Now, in the getter of this variable just add a null check to verify that call the query method if list is not initialized.

private List<O> records;

public List<O> getRecords (){
if(records == null){
records = /call the query method.
}
}

Actually, my faces table calls value attribute twice in Apply Request and Update Model phase. The above will solve your problem.
Also, in order to refresh records you need to again set records = null in the actions of buttons so that new data will be picked after the action.


You may find that the getRecords method gets called more than twice, for that matter. As a general rule, if at all possible, avoid doing things that have side-effects in the setter/getter methods of a bean. It's also a good idea for performance reasons.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Memory Leak issue
 
Similar Threads
JVMSTAT[JSTAT]
memory leak error down our site
Configure Jprofiler with tomcat.
Number of classes in memory
Memory Leak Issues