I have created a JPanel over which image is painted using paint method. I have component which creates image by making repeated calls to createImage method of that component.I haven't still painted in the JPanel but just making a call to createImage method itself results in OutOfMemoryError within the java.awt.image class. How can I prevent the memory from begin eaten up by successive calls to createImage? I have tried image.flush() and Runtime.getRuntime().gc() but it didn't work.I have also increased the heap size.but it didn't work. Excepting u'r suggestions, with regards, sonara rahul.