|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.util.ByteCache
public final class ByteCache
Cache the objects frequently used to reduce memory churn. The ByteArray should be held onto as long as the data referenced in it is needed. Heap size control - survey of usage (April 2010) :
Size Max MaxMem From 16 16 256 CryptixAESEngine 16 32 512 BloomFilterIVValidator 16 64 1K UDP PacketBuilder 16 128 2K tunnel HopProcessor 16 128 2K tunnel TrivialPreprocessor 16 128 2K tunnel InboundEndpointProcessor 16 128 2K tunnel OutboundGatewayProcessor 32 64 2K UDP PacketBuilder 32 128 4K tunnel TrivialPreprocessor 1K 32 32K tunnel TrivialPreprocessor 1K 512 512K tunnel FragmentHandler 1K 512 512K I2NP TunnelDataMessage 1K 512 512K tunnel FragmentedMessage 1730 128 216K streaming MessageOutputStream 2K 64 128K UDP IMS 4K 32 128K I2PTunnelRunner 8K 8 64K I2PTunnel HTTPResponseOutputStream 32K 4 128K SAM StreamSession 32K 10 320K SAM v2StreamSession 32K 64 2M UDP OMS 32K 128 4M streaming MessageInputStream 36K 64 2.25M streaming PacketQueue 40K 8 320K DataHelper decompress 64K 64 4M UDP MessageReceiver - disabled in 0.7.14
Method Summary | |
---|---|
ByteArray |
acquire()
Get the next available structure, either from the cache or a brand new one |
static void |
clearAll()
Clear everything (memory pressure) |
static ByteCache |
getInstance(int cacheSize,
int size)
Get a cache responsible for objects of the given size |
void |
release(ByteArray entry)
Put this structure back onto the available cache for reuse |
void |
release(ByteArray entry,
boolean shouldZero)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static ByteCache getInstance(int cacheSize, int size)
cacheSize
- how large we want the cache to grow
(number of objects, NOT memory size)
before discarding released objects.
Since 0.7.14, a limit of 1MB / size is enforced
for the typical 128MB max memory JVMsize
- how large should the objects cached be?public static void clearAll()
public final ByteArray acquire()
public final void release(ByteArray entry)
public final void release(ByteArray entry, boolean shouldZero)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |