|
2010 FRC Java API |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.squawk.GC
public class GC
Pure static class that handles object creation and GC control and monitoring.
The particular GC implementation used is a subclass of GarbageCollector
. Many of
the "public" methods of this class are actually "suite-private". See the file "squawk.library.properties"
for the list of exported methods.
Nested Class Summary | |
---|---|
static class |
GC.ClassStat
|
Method Summary | |
---|---|
static void |
arraycopy(Object src,
int srcPos,
Object dst,
int dstPos,
int lth)
Copy data from one array to another. |
static int |
calculateOopMapSizeInBytes(int size)
Calculates the size (in bytes) of an oop map that will have a bit for every word in a memory of a given size. |
static long |
freeMemory()
Returns the amount of free memory in the system. |
static int |
getArrayLength(Object array)
Get the length of an array. |
static int |
getBytesAllocatedSinceLastGC()
Get the number of bytes allocated since the last GC. |
static GarbageCollector |
getCollector()
Gets a reference to the installed collector. |
static int |
getFullCount()
Returns the number of full-heap collections. |
static int |
getHashCode(Object object)
Get the hashcode for an object. |
static Class |
getKlass(Object object)
Get the class of an object. |
static int |
getPartialCount()
Returns the number of partial-heap collections. |
static int |
getTotalCount()
Returns the total number of garbage collections that have been performed by the VM. |
static void |
initHeapStats()
Pre-create all data structures used in heap stats, so heap walking won't allocate more memory. |
static boolean |
inRam(Address start,
Address end)
Determines if any part of the range is in RAM. |
static boolean |
inRam(Object object)
Determines if a given object is in RAM. |
static boolean |
isGCEnabled()
Is Garnage collection enabled? |
static boolean |
isSafeToSwitchThreads()
Test to see if this is a safe time to switch threads. |
static String |
makeEightBitString(Object oop)
Change the type of the given object to com.sun.squawk.StringOfBytes. |
static String |
makeSixteenBitString(Object oop)
Change the type of the given object to java.lang.String. |
static void |
printEstimatedHashtableSize(SquawkHashtable tbl)
print an estimate the number of bytes used by this hastable, not including keys and values. |
static void |
printHeapStats(Object startObj,
boolean printInstances)
Do actual heap walk, from start object, or whole heap is startObj is null. |
static int |
roundUpToWord(int value)
Rounds up a 32 bit value to the next word boundry. |
static boolean |
setGCEnabled(boolean newState)
Enable or disable the garbage collector. |
static void |
stringcopy(Object src,
int srcPos,
Object dst,
int dstPos,
int lth)
Copy data from one string to another. |
static long |
totalMemory()
Returns the total amount of RAM memory in the Squawk Virtual Machine. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void arraycopy(Object src, int srcPos, Object dst, int dstPos, int lth)
src
- the source arraysrcPos
- the start position in the source arraydst
- the destination arraydstPos
- the start position in the destination arraylth
- number of elements to copypublic static int calculateOopMapSizeInBytes(int size)
size
- the size (in bytes) of the memory that the oop map will describe
size
bytespublic static long freeMemory()
gc
method may result in increasing the value returned by freeMemory.
public static int getArrayLength(Object array)
array
- the array
public static int getBytesAllocatedSinceLastGC()
public static GarbageCollector getCollector()
public static int getFullCount()
public static int getHashCode(Object object)
object
- the object the hashcode is needed for.
public static Class getKlass(Object object)
object
- the object
public static int getPartialCount()
public static int getTotalCount()
public static boolean inRam(Address start, Address end)
start
- end
-
public static boolean inRam(Object object)
object
- the object to test
object
is an instance in RAMpublic static void initHeapStats()
public static boolean isGCEnabled()
public static boolean isSafeToSwitchThreads()
public static String makeEightBitString(Object oop)
oop
- the object
public static String makeSixteenBitString(Object oop)
oop
- the object
public static void printEstimatedHashtableSize(SquawkHashtable tbl)
tbl
- public static void printHeapStats(Object startObj, boolean printInstances)
startObj
- the object to start walking from , or nullprintInstances
- if true, print information about each object before printing statisticspublic static int roundUpToWord(int value)
value
- the value to round up
public static boolean setGCEnabled(boolean newState)
newState
- the new abled/disabled state of the garbage collector
public static void stringcopy(Object src, int srcPos, Object dst, int dstPos, int lth)
src
- the source stringsrcPos
- the start position in the source stringdst
- the destination stringdstPos
- the start position in the destination stringlth
- number of characters to copypublic static long totalMemory()
Note that the amount of memory required to hold an object of any given type may be implementation-dependent.
|
2010 FRC Java API |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |