Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Out of memory exceptions with JEditorPane  RSS feed

 
Alejandro Barrero
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gentlemen:

I am loading a JEditorPane with the URL that I get from an HTML page, but it is generating OutOfMemoryError exceptions loading pictures (it is a large file). There are lots of discussions in the Internet about similar problems, but there are no solutions; in java.sun.com there is the suggestion to use
private class NonCachingEditorPane extends javax.swing.JEditorPane {
public URL getPage() {
return super.getPage();
}
}
but that didn't work. please help me with some work around.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have no idea how the little class you're showing could ever help anything.

So have you tried simply starting Java with more memory using the -XmxNNm switch, where NN is the number of megabytes to allocate for the Java heap?
 
Alejandro Barrero
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much. I should have tried that first, but I read so much about JEditorPane creating memory leaks and attempting to create a huge canvas, that It escaped me. I ran with -Xms256m -Xmx300m and it works; however, it is very slow to start (it appears to be loading a lot of things upfront). Is there any way to control the behavior of JEditorPane? are there any classes that could be extended?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!