Class RPmalloc



  • public class RPmalloc
    extends java.lang.Object
    Native bindings to the rpmalloc library. rpmalloc is a public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C.

    You are required to call these functions from your own code in order to initialize and finalize the allocator in your process and threads:

    Then simply use the malloc/free and the other malloc style replacement functions. Remember all allocations are 16-byte aligned, so no need to call the explicit memalign/aligned_alloc/posix_memalign functions unless you need greater alignment, they are simply wrappers to make it easier to replace in existing code.

    • Method Detail

      • rpmalloc_initialize

        public static void rpmalloc_initialize()
        Call at process start to initialize the allocator.

        This function also calls malloc_thread_initialize.

      • rpmalloc_finalize

        public static void rpmalloc_finalize()
        Call at process exit to finalize the allocator.
      • rpmalloc_thread_initialize

        public static void rpmalloc_thread_initialize()
        Call at each thread start to initialize the thread local data for the allocator.
      • rpmalloc_thread_finalize

        public static void rpmalloc_thread_finalize()
        Call at each thread exit to finalize and release thread cache back to global cache.
      • rpmalloc_thread_collect

        public static void rpmalloc_thread_collect()
      • rpmalloc_is_thread_initialized

        public static int rpmalloc_is_thread_initialized()
      • rpmalloc

        public static java.nio.ByteBuffer rpmalloc(long size)
      • rpfree

        public static void rpfree(java.nio.ByteBuffer ptr)
      • rpfree

        public static void rpfree(java.nio.ShortBuffer ptr)
      • rpfree

        public static void rpfree(java.nio.IntBuffer ptr)
      • rpfree

        public static void rpfree(java.nio.LongBuffer ptr)
      • rpfree

        public static void rpfree(java.nio.FloatBuffer ptr)
      • rpfree

        public static void rpfree(java.nio.DoubleBuffer ptr)
      • rpfree

        public static void rpfree(org.lwjgl.PointerBuffer ptr)
      • rpcalloc

        public static java.nio.ByteBuffer rpcalloc(long num,
                                                   long size)
      • rprealloc

        public static java.nio.ByteBuffer rprealloc(java.nio.ByteBuffer ptr,
                                                    long size)
      • rpaligned_realloc

        public static java.nio.ByteBuffer rpaligned_realloc(java.nio.ByteBuffer ptr,
                                                            long alignment,
                                                            long size,
                                                            int flags)
      • rpaligned_alloc

        public static java.nio.ByteBuffer rpaligned_alloc(long alignment,
                                                          long size)
      • rpmemalign

        public static java.nio.ByteBuffer rpmemalign(long alignment,
                                                     long size)
      • rpposix_memalign

        public static int rpposix_memalign(org.lwjgl.PointerBuffer memptr,
                                           long alignment,
                                           long size)
      • rpmalloc_usable_size

        public static long rpmalloc_usable_size(java.nio.ByteBuffer ptr)
      • rpmalloc_usable_size

        public static long rpmalloc_usable_size(java.nio.ShortBuffer ptr)
      • rpmalloc_usable_size

        public static long rpmalloc_usable_size(java.nio.IntBuffer ptr)
      • rpmalloc_usable_size

        public static long rpmalloc_usable_size(java.nio.LongBuffer ptr)
      • rpmalloc_usable_size

        public static long rpmalloc_usable_size(java.nio.FloatBuffer ptr)
      • rpmalloc_usable_size

        public static long rpmalloc_usable_size(java.nio.DoubleBuffer ptr)
      • rpmalloc_usable_size

        public static long rpmalloc_usable_size(org.lwjgl.PointerBuffer ptr)