Login  Register

Freeing a direct NIO buffer with CLinker.freeMemory() causes a double free or corruption

Posted by gouessej on Feb 24, 2023; 11:43pm
URL: https://forum.jogamp.org/Freeing-a-direct-NIO-buffer-with-CLinker-freeMemory-causes-a-double-free-or-corruption-tp4042228.html

Hello

I have to release the memory allocated on the native heap manually in T.U.E.R when going from a level to another one in order to manage this heap in a timely manner, i.e without relying on garbage collection.

However, calling CLinker.freeMemory() on a direct NIO buffer used to store texture data stops the program:
[java] AVERTISSEMENT: Attempting to update a texture that is not currently on the card.
     [java] double free or corruption (!prev)

BUILD FAILED
/home/gouessej/Documents/programmation/java/workspace/tuer/pre_beta/build.xml:430: Java returned: 134

Am I doing something completely stupid? By the way, I use OpenJDK 17. I'll try OpenJDK 19 as soon as possible.
Julien Gouesse | Personal blog | Website