Methods Summary |
---|
public void | alloc(PlatformAddress address)
AddressWrapper wrapper = new AddressWrapper(address);
synchronized (this) {
memoryInUse.put(wrapper.shadow, wrapper);
refToShadow.put(wrapper.wrAddress, wrapper.shadow);
}
|
public void | autoFree(PlatformAddress address)
AddressWrapper wrapper;
synchronized (this) {
wrapper = memoryInUse.get(address);
}
if (wrapper != null) {
wrapper.autoFree = true;
}
|
public boolean | free(PlatformAddress address)
AddressWrapper wrapper;
synchronized (this) {
wrapper = memoryInUse.remove(address);
// BEGIN android-added
if (wrapper != null) {
refToShadow.remove(wrapper.wrAddress);
}
// END android-added
}
if (wrapper == null) {
// Attempt to free memory we didn't alloc
System.err
.println("Memory Spy! Fixed attempt to free memory that was not allocated " + address); //$NON-NLS-1$
}
return wrapper != null;
|
protected void | orphanedMemory(java.lang.ref.Reference ref)
AddressWrapper wrapper;
// BEGIN android-changed
// copied from newer version of harmony
synchronized (this) {
PlatformAddress shadow = refToShadow.remove(ref);
wrapper = memoryInUse.get(shadow);
if (wrapper != null) {
// There is a leak if we were not auto-freeing this memory.
if (!wrapper.autoFree) {
System.err
.println("Memory Spy! Fixed memory leak by freeing " + wrapper.shadow); //$NON-NLS-1$
}
wrapper.shadow.free();
}
}
ref.clear();
// END android-changed
|
public void | rangeCheck(PlatformAddress address, int offset, int length)
// Do nothing
|