From 85d62d44aab541bb723416a853cdac2f577ef2d9 Mon Sep 17 00:00:00 2001 From: empirephoenix Date: Wed, 20 Jul 2016 10:35:41 +0200 Subject: [PATCH] Revert "jemalloc allocator and reflection allocator fix" --- .../java/com/jme3/util/JemallocAllocator.java | 55 ------------------- .../com/jme3/util/ReflectionAllocator.java | 2 +- 2 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 jme3-core/src/main/java/com/jme3/util/JemallocAllocator.java diff --git a/jme3-core/src/main/java/com/jme3/util/JemallocAllocator.java b/jme3-core/src/main/java/com/jme3/util/JemallocAllocator.java deleted file mode 100644 index 49325292a..000000000 --- a/jme3-core/src/main/java/com/jme3/util/JemallocAllocator.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.jme3.util; - -import static org.lwjgl.system.jemalloc.JEmalloc.*; - -import java.nio.Buffer; -import java.nio.ByteBuffer; -import java.nio.DoubleBuffer; -import java.nio.FloatBuffer; -import java.nio.IntBuffer; -import java.nio.LongBuffer; -import java.nio.ShortBuffer; - -/** - * This class contains a jemalloc allocator which is a general purpose malloc(3) implementation. - *

- * LWJGL 3 is required because it includes the jemalloc bindings and binaries. - *

- */ -public final class JemallocAllocator implements BufferAllocator -{ - @Override - public void destroyDirectBuffer(Buffer buffer) - { - if (buffer instanceof ByteBuffer) - { - je_free((ByteBuffer) buffer); - } - else if (buffer instanceof ShortBuffer) - { - je_free((ShortBuffer) buffer); - } - else if (buffer instanceof IntBuffer) - { - je_free((IntBuffer) buffer); - } - else if (buffer instanceof LongBuffer) - { - je_free((LongBuffer) buffer); - } - else if (buffer instanceof FloatBuffer) - { - je_free((FloatBuffer) buffer); - } - else if (buffer instanceof DoubleBuffer) - { - je_free((DoubleBuffer) buffer); - } - } - - @Override - public ByteBuffer allocate(int size) - { - return je_malloc(size); - } -} diff --git a/jme3-core/src/main/java/com/jme3/util/ReflectionAllocator.java b/jme3-core/src/main/java/com/jme3/util/ReflectionAllocator.java index edc342e3a..6b2c38452 100644 --- a/jme3-core/src/main/java/com/jme3/util/ReflectionAllocator.java +++ b/jme3-core/src/main/java/com/jme3/util/ReflectionAllocator.java @@ -60,7 +60,7 @@ public final class ReflectionAllocator implements BufferAllocator { } // Apache Harmony - ByteBuffer bb = ByteBuffer.allocateDirect(1); + ByteBuffer bb = BufferUtils.createByteBuffer(1); Class clazz = bb.getClass(); try { freeMethod = clazz.getMethod("free");