jmc2obj / j-mc-2-obj

Java-based Minecraft-to-OBJ exporter.
http://www.jmc2obj.net
357 stars 59 forks source link

Java OutOfMemory Error when exporting large map #265

Closed MY200378 closed 1 week ago

MY200378 commented 1 month ago

The following error is observed in the console Note in my Task Manager, neither RAM nor CPU usage had gone up to 100% jMc2OBJ-125

`ERROR: Uncaught exception in thread: ReadThread-18 java.lang.OutOfMemoryError: Java heap space at org.jmc.Chunk$SectionBlocks.(Chunk.java:420) at org.jmc.Chunk.getSectionBlocks(Chunk.java:399) at org.jmc.Chunk.access$100(Chunk.java:29) at org.jmc.Chunk$BlocksSections$1.make(Chunk.java:213) at org.jmc.Chunk$BlocksSections$1.make(Chunk.java:210) at org.jmc.util.CachedGetter.get(CachedGetter.java:61) at org.jmc.Chunk$BlocksSections.getBlockData(Chunk.java:221) at org.jmc.threading.ThreadChunkDeligate.getBlockData(ThreadChunkDeligate.java:88) at org.jmc.threading.ChunkProcessor.process(ChunkProcessor.java:193) at org.jmc.threading.ReaderRunnable.exportChunk(ReaderRunnable.java:57) at org.jmc.threading.ReaderRunnable.run(ReaderRunnable.java:36) at java.lang.Thread.run(Unknown Source)

ERROR: Uncaught exception in thread: ReadThread-0 java.lang.OutOfMemoryError: Java heap space

ERROR: Uncaught exception in thread: ReadThread-9 java.lang.OutOfMemoryError: Java heap space at org.jmc.models.Registry.getFaceUvs(Registry.java:226) at org.jmc.models.Registry.addElement(Registry.java:94) at org.jmc.models.Registry.addModel(Registry.java:62) at org.jmc.threading.ChunkProcessor.process(ChunkProcessor.java:216) at org.jmc.threading.ReaderRunnable.exportChunk(ReaderRunnable.java:57) at org.jmc.threading.ReaderRunnable.run(ReaderRunnable.java:36) at java.lang.Thread.run(Unknown Source)

Downloading new player head texture: jmc2obj:head/player_f44b52c8089650346164199e6252efcdca3d2adf2ae0cd69f7052fcb04313de ERROR: Uncaught exception in thread: ReadThread-4 java.lang.OutOfMemoryError: Java heap space

Downloading new player head texture: jmc2obj:head/player_5160bc82d8571e05bf4c3c6f2755e95b9c7692748d4c26bd61dd31dc07cb5920 Downloading new player head texture: jmc2obj:head/player_7be7e07f0184cd6f678cbf5a76e82c769bf011a4fd372211f1aea059398bc0a8 ` Initially pressing "OK" on the error window is responsive, however the program completely freezes after a few attempts

mmdanggg2 commented 1 month ago

I think by default a single java instance will use at most a quarter of your memory, you can override this by running it with java -Xmx16G -jar jmc2obj.jarwhich will allow it to use for example up to 16GB. You could also try exporting with less export threads, which will reduce the amount of memory jmc needs to complete the export as less chunks will be loaded at once.