John Doe
John Doe

Reputation: 159

Unknown issue when attempting to launch Minecraft mod (possibly memory)

I'm working on a Minecraft mod, and I am very inexperienced with Java. When I attempt to launch the mod from Eclipse, I get the following error:

---- Minecraft Crash Report ----

Time: 6/19/17 5:20 PM
Description: Registering texture

java.lang.OutOfMemoryError: Java heap space
    at     net.minecraft.client.renderer.texture.TextureUtil.uploadTextureImageSubImpl(TextureUtil.java:239)
at net.minecraft.client.renderer.texture.TextureUtil.uploadTextureImageSub(TextureUtil.java:230)
at net.minecraft.client.renderer.texture.TextureUtil.uploadTextureImageAllocate(TextureUtil.java:198)
at net.minecraft.client.renderer.texture.SimpleTexture.loadTexture(SimpleTexture.java:57)
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:67)
at net.minecraft.client.renderer.texture.TextureManager.bindTexture(TextureManager.java:42)
at net.minecraft.client.renderer.RenderGlobal.<init>(RenderGlobal.java:176)
at net.minecraft.client.Minecraft.init(Minecraft.java:555)
at net.minecraft.client.Minecraft.run(Minecraft.java:387)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)


A detailed walkthrough of the error, its code path and all known details is as follows:

-- Head --
Thread: Client thread
Stacktrace:
    at net.minecraft.client.renderer.texture.TextureUtil.uploadTextureImageSubImpl(TextureUtil.java:239)
at net.minecraft.client.renderer.texture.TextureUtil.uploadTextureImageSub(TextureUtil.java:230)
at net.minecraft.client.renderer.texture.TextureUtil.uploadTextureImageAllocate(TextureUtil.java:198)
at net.minecraft.client.renderer.texture.SimpleTexture.loadTexture(SimpleTexture.java:57)

Resource location being registered
Details:
Resource location: minecraft:textures/misc/forcefield.png
Texture object class: net.minecraft.client.renderer.texture.SimpleTexture
Stacktrace:
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:67)
at net.minecraft.client.renderer.texture.TextureManager.bindTexture(TextureManager.java:42)
at net.minecraft.client.renderer.RenderGlobal.<init>(RenderGlobal.java:176)
at net.minecraft.client.Minecraft.init(Minecraft.java:555)

Initialization
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:387)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)

System Details
Details:
Minecraft Version: 1.11.2
Operating System: Mac OS X (x86_64) version 10.10
Java Version: 1.6.0_65, Apple Inc.
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Apple Inc.
Memory: 6342424 bytes (6 MB) / 129957888 bytes (123 MB) up to 129957888 bytes (123 MB)
JVM Flags: 0 total; 
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP 9.38 Powered by Forge 13.20.0.2228 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCH minecraft{1.11.2} [Minecraft] (minecraft.jar) 
UCH mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
UCH FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.11.2-13.20.0.2228.jar) 
UCH forge{13.20.0.2228} [Minecraft Forge] (forgeSrc-1.11.2-13.20.0.2228.jar) 
Loaded coremods (and transformers): 
Launched Version: 1.11.2
LWJGL: 2.9.2
OpenGL: Intel HD Graphics 5000 OpenGL Engine GL version 2.1 INTEL-10.0.86, Intel Inc.
GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because ARB_framebuffer_object is supported     and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

Using VBOs: Yes
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: 
Current Language: English (US)
Profiler Position: N/A (disabled)
CPU: 4x Intel(R) Core(TM) i5-4250U CPU @ 1.30GHz

The mod simply adds an untextured item, but it was giving me the same error before I even added that.

I also got this error in Eclipse, which led me to my suspicious that the problem has something to do with memory:

AL lib: (EE) alc_cleanup: 1 device not closed

Any help is appreciated.

Upvotes: 0

Views: 728

Answers (1)

user8162574
user8162574

Reputation:

The JVM ran out of memory. However much you gave it, it wasn't enough. You need to increase it.

Note: This fix specifies 3GB of memory be allocated to the JVM, which means your computer will need at least that much plus more for the OS, so 4GB total or more.

To fix this go into the JVM argument settings and copy and paste this into it:

-Xmx3G -Xms3G -Xmn768m -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseNUMA -XX:+CMSParallelRemarkEnabled -XX:MaxTenuringThreshold=15 -XX:MaxGCPauseMillis=30 -XX:GCPauseIntervalMillis=150 -XX:+UseAdaptiveGCBoundary -XX:-UseGCOverheadLimit -XX:+UseBiasedLocking -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=15 -Dfml.ignorePatchDiscrepancies=true -Dfml.ignoreInvalidMinecraftCertificates=true -XX:+UseFastAccessorMethods -XX:+UseCompressedOops -XX:+OptimizeStringConcat -XX:+AggressiveOpts -XX:ReservedCodeCacheSize=2048m -XX:+UseCodeCacheFlushing -XX:SoftRefLRUPolicyMSPerMB=10000 -XX:ParallelGCThreads=10

The -Xmx3G flag says how much the JVM gets, maximum. In this case 3GB. If the JVM runs out of memory again, you can increase this value further (although you're still limited by the amount physically available).

The -Xms3G flag says how much the JVM starts with. In this case also 3GB.

The rest of the flags deal with optimizing garbage collection, these settings are tuned for Minecraft and fiddling with them might actually make things worse.

Upvotes: 3

Related Questions