This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Is there Memory leak..?

vishwas bhatt
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Folks look at this u find any problem in this method as far as memory is there any memory leak in this..?

protected static Image loadImage(Image img, String strImage) {
if(img != null) return img;
Image img2 = null;

img2 = Image.createImage(strImage);
catch (Exception e)
System.out.println ("Image loading error: "+strImage);

return img2;

Usage: Image mapBG = loadImage(mapBG,"/map.png");
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!