Aivean / royalroad-downloader

https://royalroad.com book downloader
MIT License
57 stars 4 forks source link

32-bit failure #17

Closed Zageron closed 4 years ago

Zageron commented 4 years ago

Hey, figured it would be good to note that if people have the 32-bit version of java installed this command fails due to the colossal size of the story.

java -jar .\royalroad-downloader-assembly-2.1.0.jar https://www.royalroad.com/fiction/11209/the-legend-of-randidly-ghosthound

The previous solution #8, didn't work. I resolved it by switching to 64 and then running with -Xmx6G.

Aivean commented 4 years ago

Thanks for pointing that out! Indeed, 32bit systems can address only 4Gb of memory and in reality java heap limit on such systems is even smaller:

Why can't I get a larger heap with the 32-bit JVM?

The maximum theoretical heap limit for the 32-bit JVM is 4G. Due to various additional constraints such as available swap, kernel address space usage, memory fragmentation, and VM overhead, in practice the limit can be much lower. On most modern 32-bit Windows systems the maximum heap size will range from 1.4G to 1.6G. On 32-bit Solaris kernels the address space is limited to 2G. On 64-bit operating systems running the 32-bit VM, the max heap size can be higher, approaching 4G on many Solaris systems. As of Java SE 6, the Windows /3GB boot.ini feature is not supported. If your application requires a very large heap you should use a 64-bit VM on a version of the operating system that supports 64-bit applications. See Java SE Supported System Configurations for details.

https://www.oracle.com/java/technologies/hotspotfaq.html#gc_heap_32bit

Frankly, there is no real reason for royalroad-downloader to try to fit whole book in memory, I should probably address this in the future.