Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to download beyond 900 chapters - OutOfMemoryError #58

Closed
emberGlyph opened this issue Sep 5, 2020 · 8 comments
Closed

Unable to download beyond 900 chapters - OutOfMemoryError #58

emberGlyph opened this issue Sep 5, 2020 · 8 comments

Comments

@emberGlyph
Copy link

Tried to download some novels on novelfull, when I get to chapter 900-1000ish, it just stops.

Ran it with the console and got the following error code:
Exception in thread "pool-2-thread-1" java.lang.OutOfMemoryError: Java heap space
at org.jsoup.parser.CharacterReader.(CharacterReader.java:36)
at org.jsoup.parser.CharacterReader.(CharacterReader.java:41)
at org.jsoup.parser.TreeBuilder.initialiseParse(TreeBuilder.java:38)
at org.jsoup.parser.HtmlTreeBuilder.initialiseParse(HtmlTreeBuilder.java:65)
at org.jsoup.parser.TreeBuilder.parse(TreeBuilder.java:46)
at org.jsoup.parser.Parser.parseInput(Parser.java:35)
at org.jsoup.helper.DataUtil.parseInputStream(DataUtil.java:175)
at org.jsoup.helper.HttpConnection$Response.parse(HttpConnection.java:835)
at org.jsoup.helper.HttpConnection.get(HttpConnection.java:287)
at grabber.scripts.ChapterContentScripts.defaults(ChapterContentScripts.java:222)
at grabber.scripts.ChapterContentScripts.fetchContent(ChapterContentScripts.java:45)
at grabber.Chapter.saveChapter(Chapter.java:48)
at grabber.Novel.downloadChapters(Novel.java:137)
at gui.GUI.lambda$null$2(GUI.java:332)
at gui.GUI$$Lambda$67/20323159.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

It seems that Java ran out of memory. Is there a way to allocate more RAM to the program? Thanks for your work.

@emberGlyph
Copy link
Author

I seem to have fixed it by downloading and using the Java 64-bit. Downloaded from here: https://www.java.com/en/download/manual.jsp

Maybe you can let Java 64-bit to be one of the prerequisite of using the program? Anyways, thanks again for your work. It makes my military life so much better.

@Flameish
Copy link
Owner

Flameish commented Sep 5, 2020

Thanks for the info! I'm not sure what the default heap size on 32-bit is but it seems to be pretty low. You can manually increase it with the parameters -xms / -xmx (java -Xms1g -Xmx2g -jar NovelGrabber...) so I don't think 64-bit is a requirement just yet.
If a novel take more than 4gb of memory (32-bit limit) I'll seriously need to reevaluate my memory management.

@emberGlyph
Copy link
Author

emberGlyph commented Sep 5, 2020 via email

@Flameish
Copy link
Owner

Flameish commented Sep 5, 2020

Tested it with 50 MB. Ran out of memory after 160 chapters / 800 pages w/o images. I'm going to take a look where I can optimize it.

@Flameish Flameish changed the title Unable to download beyond 900 chapters Unable to download beyond 900 chapters - OutOfMemoryError Sep 5, 2020
@emberGlyph
Copy link
Author

emberGlyph commented Sep 6, 2020 via email

@emberGlyph emberGlyph reopened this Sep 6, 2020
@Flameish
Copy link
Owner

Flameish commented Sep 7, 2020

Cleared some unused chapter fields which improved garbage collection. Managed ~750 chapters on 50 MB

This is after 1300 chapters on default java settings:
image

@xx255q
Copy link

xx255q commented Sep 10, 2020

What changed from before where i could download 4000+ chapters without issue

@Flameish
Copy link
Owner

Sometimes it could look like this for some novels: (~200 chapters)
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants