Top Description Inners Constructors Methods
org.lwjgl.system

pack-priv final Class MemoryManage

extends Object
Class Inheritance
Imports
org.lwjgl.system.libffi.*, javax.annotation.*, java.util.*, java.util.Map.*, java.util.concurrent.*, java.util.concurrent.atomic.*

Provides MemoryAllocator implementations for MemoryUtil to use.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
MemoryManage.DebugAllocator

Wraps a MemoryAllocator to track allocations and detect memory leaks.

private static class
MemoryManage.StdlibAllocator

stdlib memory allocator.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static MemoryUtil.MemoryAllocator
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

MemoryManageback to summary
private MemoryManage()

Method Detail

getInstanceback to summary
pack-priv static MemoryUtil.MemoryAllocator getInstance()
org.lwjgl.system back to summary

pack-priv Class MemoryManage.DebugAllocator

extends Object
implements MemoryAllocator
Class Inheritance
All Implemented Interfaces
org.lwjgl.system.MemoryUtil.MemoryAllocator

Wraps a MemoryAllocator to track allocations and detect memory leaks.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static final ConcurrentMap<MemoryManage.DebugAllocator.Allocation, MemoryManage.DebugAllocator.Allocation>
private final MemoryUtil.MemoryAllocator
private final long[]
private static final ConcurrentMap<Long, String>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static <T> void
aggregate(T t, long size, Map<T, AtomicLong> map)

public long
public void
public long
public void
public long
getAlignedAlloc()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getAlignedAlloc.

Returns a pointer to the aligned_alloc function.
public long
getAlignedFree()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getAlignedFree.

Returns a pointer to the aligned_free function.
public long
getCalloc()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getCalloc.

Returns a pointer to the calloc function.
public long
getFree()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getFree.

Returns a pointer to the free function.
public long
getMalloc()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getMalloc.

Returns a pointer to the malloc function.
public long
getRealloc()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getRealloc.

Returns a pointer to the realloc function.
public long
public long
pack-priv static void
pack-priv static void
report(MemoryUtil.MemoryAllocationReport report, MemoryUtil.MemoryAllocationReport.Aggregate groupByStackTrace, boolean groupByThread)

private static void
reportAll(MemoryUtil.MemoryAllocationReport report, boolean groupByThread)

private static void
reportByMethod(MemoryUtil.MemoryAllocationReport report, boolean groupByThread)

private static void
reportByStacktrace(MemoryUtil.MemoryAllocationReport report, boolean groupByThread)

pack-priv static long
track(long address, long size)

private static void
private static void
pack-priv static long
untrack(long address)

private static void
untrackAbort(long address)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ALLOCATIONSback to summary
private static final ConcurrentMap<MemoryManage.DebugAllocator.Allocation, MemoryManage.DebugAllocator.Allocation> ALLOCATIONS
allocatorback to summary
private final MemoryUtil.MemoryAllocator allocator
callbacksback to summary
private final long[] callbacks
THREADSback to summary
private static final ConcurrentMap<Long, String> THREADS

Constructor Detail

DebugAllocatorback to summary
pack-priv DebugAllocator(MemoryUtil.MemoryAllocator allocator)

Method Detail

aggregateback to summary
private static <T> void aggregate(T t, long size, Map<T, AtomicLong> map)
aligned_allocback to summary
public long aligned_alloc(long alignment, long size)

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.aligned_alloc.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.aligned_alloc.

Called by MemoryUtil#memAlignedAlloc.

Annotations
@Override
aligned_freeback to summary
public void aligned_free(long ptr)

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.aligned_free.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.aligned_free.

Called by MemoryUtil#memAlignedFree.

Annotations
@Override
callocback to summary
public long calloc(long num, long size)

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.calloc.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.calloc.

Called by MemoryUtil#memCalloc.

Annotations
@Override
freeback to summary
public void free(long ptr)

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.free.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.free.

Called by MemoryUtil#memFree.

Annotations
@Override
getAlignedAllocback to summary
public long getAlignedAlloc()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getAlignedAlloc.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.getAlignedAlloc.

Returns a pointer to the aligned_alloc function.

Annotations
@Override
getAlignedFreeback to summary
public long getAlignedFree()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getAlignedFree.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.getAlignedFree.

Returns a pointer to the aligned_free function.

Annotations
@Override
getCallocback to summary
public long getCalloc()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getCalloc.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.getCalloc.

Returns a pointer to the calloc function.

Annotations
@Override
getFreeback to summary
public long getFree()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getFree.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.getFree.

Returns a pointer to the free function.

Annotations
@Override
getMallocback to summary
public long getMalloc()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getMalloc.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.getMalloc.

Returns a pointer to the malloc function.

Annotations
@Override
getReallocback to summary
public long getRealloc()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getRealloc.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.getRealloc.

Returns a pointer to the realloc function.

Annotations
@Override
mallocback to summary
public long malloc(long size)

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.malloc.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.malloc.

Called by MemoryUtil#memAlloc.

Annotations
@Override
reallocback to summary
public long realloc(long ptr, long size)

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.realloc.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.realloc.

Called by MemoryUtil#memRealloc.

Annotations
@Override
reportback to summary
pack-priv static void report(MemoryUtil.MemoryAllocationReport report)
reportback to summary
pack-priv static void report(MemoryUtil.MemoryAllocationReport report, MemoryUtil.MemoryAllocationReport.Aggregate groupByStackTrace, boolean groupByThread)
reportAllback to summary
private static void reportAll(MemoryUtil.MemoryAllocationReport report, boolean groupByThread)
reportByMethodback to summary
private static void reportByMethod(MemoryUtil.MemoryAllocationReport report, boolean groupByThread)
reportByStacktraceback to summary
private static void reportByStacktrace(MemoryUtil.MemoryAllocationReport report, boolean groupByThread)
trackback to summary
pack-priv static long track(long address, long size)
trackAbortback to summary
private static void trackAbort(long address, MemoryManage.DebugAllocator.Allocation allocationOld, MemoryManage.DebugAllocator.Allocation allocationNew)
trackAbortPrintback to summary
private static void trackAbortPrint(MemoryManage.DebugAllocator.Allocation allocation, String name, String address)
untrackback to summary
pack-priv static long untrack(long address)
untrackAbortback to summary
private static void untrackAbort(long address)
org.lwjgl.system back to summary

private Class MemoryManage.DebugAllocator.Allocation

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final long
pack-priv final long
private final Object[]
pack-priv final long

Constructor Summary

AccessConstructor and Description
pack-priv
Allocation(long address, long size, long threadId, Object[] stacktrace)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
private StackTraceElement[]
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

addressback to summary
pack-priv final long address
sizeback to summary
pack-priv final long size
stacktraceback to summary
private final Object[] stacktrace
Annotations
@Nullable
threadIdback to summary
pack-priv final long threadId

Constructor Detail

Allocationback to summary
pack-priv Allocation(long address, long size, long threadId, Object[] stacktrace)

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@SuppressWarnings:EqualsWhichDoesntCheckParameterClass
@Override
getElementsback to summary
private StackTraceElement[] getElements()
Annotations
@Nullable
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
org.lwjgl.system back to summary

private Class MemoryManage.DebugAllocator.AllocationKey

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final StackTraceElement[]

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

elementsback to summary
pack-priv final StackTraceElement[] elements

Constructor Detail

AllocationKeyback to summary
pack-priv AllocationKey(StackTraceElement[] elements)

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@SuppressWarnings:EqualsWhichDoesntCheckParameterClass
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
org.lwjgl.system back to summary

private Class MemoryManage.StdlibAllocator

extends Object
implements MemoryAllocator
Class Inheritance
All Implemented Interfaces
org.lwjgl.system.MemoryUtil.MemoryAllocator

stdlib memory allocator.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public long
public void
public long
public void
public long
getAlignedAlloc()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getAlignedAlloc.

Returns a pointer to the aligned_alloc function.
public long
getAlignedFree()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getAlignedFree.

Returns a pointer to the aligned_free function.
public long
getCalloc()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getCalloc.

Returns a pointer to the calloc function.
public long
getFree()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getFree.

Returns a pointer to the free function.
public long
getMalloc()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getMalloc.

Returns a pointer to the malloc function.
public long
getRealloc()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getRealloc.

Returns a pointer to the realloc function.
public long
public long
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

StdlibAllocatorback to summary
private StdlibAllocator()

Method Detail

aligned_allocback to summary
public long aligned_alloc(long alignment, long size)

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.aligned_alloc.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.aligned_alloc.

Called by MemoryUtil#memAlignedAlloc.

Annotations
@Override
aligned_freeback to summary
public void aligned_free(long ptr)

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.aligned_free.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.aligned_free.

Called by MemoryUtil#memAlignedFree.

Annotations
@Override
callocback to summary
public long calloc(long num, long size)

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.calloc.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.calloc.

Called by MemoryUtil#memCalloc.

Annotations
@Override
freeback to summary
public void free(long ptr)

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.free.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.free.

Called by MemoryUtil#memFree.

Annotations
@Override
getAlignedAllocback to summary
public long getAlignedAlloc()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getAlignedAlloc.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.getAlignedAlloc.

Returns a pointer to the aligned_alloc function.

Annotations
@Override
getAlignedFreeback to summary
public long getAlignedFree()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getAlignedFree.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.getAlignedFree.

Returns a pointer to the aligned_free function.

Annotations
@Override
getCallocback to summary
public long getCalloc()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getCalloc.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.getCalloc.

Returns a pointer to the calloc function.

Annotations
@Override
getFreeback to summary
public long getFree()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getFree.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.getFree.

Returns a pointer to the free function.

Annotations
@Override
getMallocback to summary
public long getMalloc()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getMalloc.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.getMalloc.

Returns a pointer to the malloc function.

Annotations
@Override
getReallocback to summary
public long getRealloc()

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.getRealloc.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.getRealloc.

Returns a pointer to the realloc function.

Annotations
@Override
mallocback to summary
public long malloc(long size)

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.malloc.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.malloc.

Called by MemoryUtil#memAlloc.

Annotations
@Override
reallocback to summary
public long realloc(long ptr, long size)

Implements org.lwjgl.system.MemoryUtil.MemoryAllocator.realloc.

Doc from org.lwjgl.system.MemoryUtil.MemoryAllocator.realloc.

Called by MemoryUtil#memRealloc.

Annotations
@Override