org.lwjgl.system.rpmalloc.RPmallocAllocator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lwjgl-rpmalloc Show documentation
Show all versions of lwjgl-rpmalloc Show documentation
A public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C.
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.system.rpmalloc;
import org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.rpmalloc.RPmalloc.*;
/** A {@link MemoryAllocator} implementation using the rpmalloc library. */
public class RPmallocAllocator implements MemoryAllocator {
static {
// initialize rpmalloc
LibRPmalloc.initialize();
rpmalloc_initialize();
}
@Override
public long getMalloc() { return rpmalloc_address(); }
@Override
public long getCalloc() { return rpcalloc_address(); }
@Override
public long getRealloc() { return rprealloc_address(); }
@Override
public long getFree() { return rpfree_address(); }
@Override
public long getAlignedAlloc() { return rpaligned_alloc_address(); }
@Override
public long getAlignedFree() { return rpfree_address(); }
@Override
public long malloc(long size) {
return nrpmalloc(size);
}
@Override
public long calloc(long num, long size) {
return nrpcalloc(num, size);
}
@Override
public long realloc(long ptr, long size) {
return nrprealloc(ptr, size);
}
@Override
public void free(long ptr) {
nrpfree(ptr);
}
@Override
public long aligned_alloc(long alignment, long size) {
return nrpaligned_alloc(alignment, size);
}
@Override
public void aligned_free(long ptr) {
nrpfree(ptr);
}
}