Switching texture packs several times eventually exhausts all available memory and crashes the game. Specifically, direct memory (as in ByteBuffer.allocateDirect), not the Java heap, fills up. This happens even without loading up a world.
To reproduce this more easily, limit the amount of memory available to Java by adding -Xmx512M -Xms512M -XX:MaxDirectMemorySize=512M to the command line.
Related issues
is duplicated by
Attachments
Comments


Cannot reproduce.
With the default 1GB heap I can switch 20 times between texture packs.
Maybe an upgrade to Java 1.7 will solve your issue.
I first saw the crash with Misa's 1.5 texture pack, but since that's unreleased I made my own pack to illustrate the problem. Attached whoa15.zip which upscales the default textures to 64x and adds a 30-frame animation to each. Here's another crash report with the default heap size (1772MB in my case). Switching between default and whoa15.zip 4-5 times was enough to exhaust direct memory and crash.

Can reproduce by switching Default -> Whoa -> Default 4 times (Default heap size)
(Got eye cancer 😉 )
Java 7U17...
Same crash report as already reported.
Console output:
2013-03-10 17:44:16 [CLIENT] [INFO] Found animation info for: textures/blocks/workbench_side.txt
2013-03-10 17:44:16 [CLIENT] [INFO] Found animation info for: textures/blocks/workbench_top.txt
2013-03-10 17:44:16 [CLIENT] [INFO] Found animation info for: textures/blocks/lava_flow.txt
2013-03-10 17:44:16 [CLIENT] [INFO] Found animation info for: textures/blocks/water_flow.txt
2013-03-10 17:44:16 [CLIENT] [INFO] Found animation info for: textures/blocks/fire_0.txt
2013-03-10 17:44:16 [CLIENT] [INFO] Found animation info for: textures/blocks/fire_1.txt
2013-03-10 17:44:16 [CLIENT] [INFO] Found animation info for: textures/blocks/lava.txt
2013-03-10 17:44:16 [CLIENT] [INFO] Found animation info for: textures/blocks/portal.txt
2013-03-10 17:44:16 [CLIENT] [INFO] Found animation info for: textures/blocks/water.txt
2013-03-10 17:44:26 [SERVER] [INFO] Stopping server
2013-03-10 17:44:26 [SERVER] [INFO] Saving players
u: Rendering screen
at bfk.b(SourceFile:791)
at net.minecraft.client.Minecraft.K(SourceFile:595)
at net.minecraft.client.Minecraft.run(SourceFile:524)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.OutOfMemoryError: Direct buffer memory
at java.nio.Bits.reserveMemory(Unknown Source)
at java.nio.DirectByteBuffer.<init>(Unknown Source)
at java.nio.ByteBuffer.allocateDirect(Unknown Source)
at bii.a(SourceFile:395)
at bii.<init>(SourceFile:135)
at bii.<init>(SourceFile:107)
at bik.a(SourceFile:127)
at bik.c(SourceFile:94)
at bil.b(SourceFile:80)
at bfy.d(SourceFile:351)
at bfy.c(SourceFile:301)
at bjr.a(SourceFile:146)
at axn.a(SourceFile:175)
at bjq.a(SourceFile:109)
at bfk.b(SourceFile:768)
... 3 more
2013-03-10 17:44:26 [SERVER] [INFO] Saving worlds
2013-03-10 17:44:26 [SERVER] [INFO] Saving chunks for level 'Test-Welt'/Overworld
2013-03-10 17:44:26 [SERVER] [INFO] Saving chunks for level 'Test-Welt'/Nether
2013-03-10 17:44:26 [SERVER] [INFO] Saving chunks for level 'Test-Welt'/The End
2013-03-10 17:44:36 [CLIENT] [INFO] Stopping!
Note:
Description: Rendering screen
java.lang.OutOfMemoryError: Direct buffer memory
at java.nio.Bits.reserveMemory(Bits.java:632)
at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:97)
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
at bii.a(SourceFile:395)
This error can be reproduced by using an HD texture pack with a resolution of 256x256 or higher. Texture packs of resolution 64x64 and 128x128 may potentially produce the same results, but it will happen at a much slower pace.
A client-side singleplayer version error:
java.lang.OutOfMemoryError: Direct buffer memory
at java.nio.Bits.reserveMemory(Bits.java:632)
at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:97)
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
at bii.a(SourceFile:395)
at bii.<init>(SourceFile:135)
at bii.<init>(SourceFile:107)
at bik.a(SourceFile:127)
at bik.c(SourceFile:100)
at bil.b(SourceFile:80)
at bfy.d(SourceFile:350)
at bfy.c(SourceFile:301)
at bjr.a(SourceFile:146)
at axn.a(SourceFile:175)
at bjq.a(SourceFile:109)
at bfk.b(SourceFile:768)
at net.minecraft.client.Minecraft.K(SourceFile:595)
at net.minecraft.client.Minecraft.run(SourceFile:524)
at java.lang.Thread.run(Thread.java:662)
(Memory at that points hits around 220,000K, approximately 6GB of RAM was being used at that moment)
i see a very large memory leak with 256x texture packs and noted the game will go to 0 FPS and i have 5gigs allocated to minecraft and will will instantly fill all that up and freeze testing with 128x shows that it leaks but it runs around 8 FPS and testing with 64x it runs around 40-60 and using default 16x it runs fine hope this info helps
Affects 1.5.1.
I have 64-bit Java 7. The game runs fine with any 64x64 textures. With any 128x128 textures I get constant lag. I always have 30-100 FPS on my high-end PC. I wonder if the lag is related to this issue.
Affects 13w16a.
I had some really odd trouble getting a 256x pack to load, when testing the 1.5.2 release. When I clicked on the 256x pack to select it, Minecraft would freeze, as usual, but then after some time, the default texture pack would come up selected instead. I repeatedly clicked the 256x pack again and again until Minecraft crashed due due a lack of memory allocated. I had 2GB out of my system's 8GB allocated just FYI. I also got an OS warning, where Windows was telling me that my system was low on free RAM (which comes to me as a surprise as I rarely go over >6GB of usage). I looked in Task Manager and saw that the JVM was using (wait for it...) 4GB of my RAM (in total 89% of my RAM was in use). So the memory leak appears to be in 1.5.2 too it seems. I haven't tested the 13w17a snapshot yet, I hope it's been fixed there, along with the poor FPS issues, which were only partly fixed in 1.5.2.
Edit: forgot to mention I was running Minecraft under Java 6 (1.6.0.41).
Fixed in 13w18c