Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9294519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T21:23:33+00:00 2026-06-18T21:23:33+00:00

Currently experimenting with OpenGL in Java. After running the following test code several cycles

  • 0

Currently experimenting with OpenGL in Java. After running the following test code several cycles within NetBeans, I receive a low memory error and the program terminates. The issue occurs some time after having run the application through a few successful cycles.

Why does this happen and how can it be fixed?

Code:

package test3d;

import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
import org.lwjgl.input.Keyboard;

class ColoredTriangle {
    public void start() {
        try {
            Display.setFullscreen(true);
            DisplayMode dm = new DisplayMode(34,34);
           // Display.setDisplayMode(new DisplayMode(DisplayMode.get));
            Display.create();
        } catch (LWJGLException e) {
            e.printStackTrace();
            System.exit(0);
        }

         // Init OpenGL
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glLoadIdentity();
        GL11.glOrtho(-3, 3, -2.4, 2.4, -1, 1);
        GL11.glRotatef(0.0f,5.0f,1.0f,0.0f); 
        //GL11.glOrtho(0, 640, 480, 0, 1, -1);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);

        boolean quit = false;

        while (!quit) {         
            // Clear the screen.
            GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
            //GL11.glFrontFace(GL11.GL_CCW);
            // Begin drawing
            GL11.glBegin(GL11.GL_QUADS);
            GL11.glColor3f(1.0f,0.0f,0.0f); //Red   

     /*
                GL11.glVertex3f(0.0f,0.0f, 0.0f);

                GL11.glVertex3f(0.0f,1.0f, 0.0f);

                GL11.glVertex3f(1.0f,1.0f, 0.0f);

                GL11.glVertex3f(1.0f,0.0f, 0.0f); //*/


                 GL11.glVertex3f(1.0f,0.0f, -1f);

                GL11.glVertex3f(1.0f,1.0f, -1f);

                GL11.glVertex3f(2.0f,1.0f, -1f);

                GL11.glVertex3f(2.0f,0.0f, -1f);

              GL11.glEnd();  



            Display.update();

            if (Display.isCloseRequested() || Keyboard.isKeyDown(Keyboard.KEY_ESCAPE))
                quit = true;
        }

        Display.destroy();
        System.exit(0);
    }
}
class Test3d
{
    public static void main(String args[]) {
        ColoredTriangle ct = new ColoredTriangle();
        ct.start();
    }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T21:23:34+00:00Added an answer on June 18, 2026 at 9:23 pm

    This is a known problem with NetBeans.

    NetBeans JVM is not unloading the LWJGL DLL after each recycle, which is called via JNI through LWJGL on each execution of your application.

    I know of a similar issue (see this SO question referencing it) with the Tomcat Application Server running a web application which uses JNI. If you unload and reload said JNI-accessing web application using the Tomcat administrator, the DLLs referenced by JNI are not unloaded and all sorts of problems and conflicts are encountered when the application is started back up. The proper usage in said case is to completely stop the Tomcat service, then start Tomcat again. It creates headaches for those who want to use the admin to update their JNI-referencing deployables; they have to do it manually.

    Based on your evidence and the first link, NetBeans also suffers from this issue and the only workarounds are to either:

    1. not reload your application so often
    2. restart the IDE after a couple of application reloads
    3. use a different IDE that might not do this (perhaps Eclipse?)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently experimenting with HTML5 Drag and Drop API. Now I've got several questions:
I am fairly new to java and I am currently experimenting with sockets and
I'm currently experimenting with jade template engine. I've got the follow basic code in
I'm currently experimenting with Yesod by following the tutorial on the Yesod Wiki .
I'm experimenting with the zipfile module of python the code i currently use is
I'm currently experimenting with generics in C#, and came up with the following challenge
I'm currently experimenting on self replicating code. Out of love for the language I'd
I'm currently experimenting and trying to get this code: $processnames = Get-Process | select
I'm currently experimenting with some RESTful JAX and I want to validate a custom
I am currently experimenting with asynchronous function-calls in jQuery and am stuck. Consider the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.