• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

memory impact on statement

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you.
 
There is no greater crime than stealing somebody's best friend. I miss you tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic