LWJGL Forum

Programming => Bug Reports / RFE => Topic started by: CJ Burkey on June 06, 2017, 02:13:38

Title: BufferedImage Causes Crash Only in LWJGL Project
Post by: CJ Burkey on June 06, 2017, 02:13:38
This problem may not be LWJGL, but it only occurs when it is present. I'm experiencing something really strange, and I don't know what's causing it at all. This is the problematic line of code:
BufferedImage out = new BufferedImage(256, 256, BufferedImage.TYPE_INT_RGB);
This code can be called anywhere, in any thread, and instantly all threads freeze. If it is called before GLFW is bound, the thread doesn't freeze, everything gets called, but the GLFW window never opens. Note: I am using Mac, so I have -XstartOnFirstThread as a JVM argument, but I don't think that would cause it.

Actually, it is not related to that argument, it runs perfectly fine with and without it in another test project without LWJGL.
Title: Re: BufferedImage Causes Crash Only in LWJGL Project
Post by: spasi on June 06, 2017, 04:33:28
See this reply (http://forum.lwjgl.org/index.php?topic=6516.msg34573#msg34573).
Title: Re: BufferedImage Causes Crash Only in LWJGL Project
Post by: CJ Burkey on June 07, 2017, 18:41:02
Quote from: spasi on June 06, 2017, 04:33:28
See this reply (http://forum.lwjgl.org/index.php?topic=6516.msg34573#msg34573).

I did end up finding a solution to the problem here: https://stackoverflow.com/questions/44379870/java-creating-instance-of-bufferedimage-freezes-program (https://stackoverflow.com/questions/44379870/java-creating-instance-of-bufferedimage-freezes-program). As long as I don't use it before GLFW is initialized, with that JVM argument, it works well.
Title: Re: BufferedImage Causes Crash Only in LWJGL Project
Post by: orange451 on July 21, 2017, 03:28:48
You should try to migrate away from BufferedImage though. It uses a considerable amount of Memory, and is quite slower than the STB library included with LWJGL3