• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

memory impact on statement

 
bhagyaapatil apatil
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I am getting outofmemory exception in a webpage.In the related java class i have used Statement to retrieve the data from DB (oracle).
does usage of prepared statement and statement makes any impact on
memory?
If i presume there is memory problem.
But this exceptions occurs only at particular page rest of the things are working fine.
and i have increased the jvm headp size by setting a catalina_opts environment var and in Catalina.bat also i have set this JAVA_OPTS .

Can any one help me to find out what could be the problem?
whether it is related to statment or preparedstatement or something else.
or any other suggestions for how we can debug for memory leak in java class.

thanks
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34229
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first thing to do is use a memory profiler to see if you actually have a memory problem in this class.

Presuming you do, the problem is highly unlikely to be the choice of Statement vs PreparedStatement. I would check if you have any static variables (the only practical way to have a memory leak in Java) or if you are returning a tremendous amount of data from the query.
 
bhagyaapatil apatil
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.

May I know how memory profiler is used which you mentioned.
Do you mean logging the max memory, total memory and free memory?

I have done it. even though i have set max memory as 700MB its showing max memory very less.
As Max Memory 694MB
Total Memory 76MB
Free memory 3MB
I would like to know how we set jvm max memory size.
catalina.bat java_opts=-X..
or setting java_opts as environment


In my java class i am using Prepared statment in all methods.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34229
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by bhagyaapatil apatil:
May I know how memory profiler is used which you mentioned.

There are a number of different memory profiling tools. Here's a list of open source ones.


Originally posted by bhagyaapatil apatil:
Do you mean logging the max memory, total memory and free memory?

No. That just tells you that you are low on memory. A memory profiler will tell you which class it is.
 
bhagyaapatil apatil
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic