0

How to solved Memory Leak on ImageIcon in Java?

ImageIcon icon_requirements    = new ImageIcon(new ImageIcon(getClass().getResource("images/icon_error.png")).getImage().getScaledInstance(15, 15, Image.SCALE_SMOOTH));
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • 1
    How do you know there is a memory leak? Is the code throwing an `OutOfMemoryError`? – Andrew Thompson Jan 11 '20 at 11:55
  • Yes i Know. it always throwing an OutOfMemoryError – raymond santos Jan 17 '20 at 03:00
  • Yes i Know. it always throwing an OutOfMemoryError – raymond santos Jan 17 '20 at 03:01
  • 1) For better help sooner, [edit] to add a [MCVE] or [Short, Self Contained, Correct Example](http://www.sscce.org/). 2) One way to get image(s) for an example is to hot link to images seen in [this Q&A](http://stackoverflow.com/q/19209650/418556). E.G. [This answer](https://stackoverflow.com/a/10862262/418556) hot links to an image embedded in [this question](https://stackoverflow.com/q/10861852/418556). – Andrew Thompson Jan 17 '20 at 04:29

0 Answers0