Trying connect to some sites with Jsoup on Android, and it throws java.lang.OutOfMemoryError exception. Example:
Jsoup.connect("http://www.xbox360achievements.org/game/grand-theft-auto-iv/guide/").get();
What could be done to avoid this problem?
Jsoup 1.7.1
An OutOfMemoryError means that your application is using more memory than is available to it. (Duh!)
Your options are:
Increase the amount of memory that the app is allowed to use.
Decrease the amount of memory that the app does use. For instance:
Don't read and buffer the entire document before parsing it with jsoup.
Make sure that you are not keeping too much information in memory from the pages you are crawling. Either write it to the file system, or "reduce" it on the fly.
Profile the app's memory usage to look for leaks and other problems with excessive memory use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With