cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michel Lehon" <Michel.Le...@Outwares.com>
Subject MemoryStore for Cocoon 1.7.x
Date Fri, 07 Apr 2000 14:12:35 GMT
Hi,

After much tests with SoftReferences and no results I decided to try to
implement something in between. So Here is a patch for MemoryStore, it adds
the follwing capabilities:

Use of a daemon thread to watch the amount of allocated memory, if the
memory goes over the allowed limit, it will try to free some by removing
items from the Store.
This has the added benefit of being compatible with JDK1.1 (even tough I
could not test it, as I don't have JDK 1.1 on my machine).

It accepts a few parameters (from cocoon.properties):
- freememory = How much memory to keep free for normal jvm operation.
(Default: 1 Mb)
- heapsize = The size of the heap before cleanup starts. (Default: 60 Mb)
- usethread = use a cleanup daemon thread. (Default: true)
- threadpriority = priority to run cleanup thread (1-10). (Default: 10)
- interval = time in millis to sleep between memory checks (Default: 100
millis)

I needed both freememory and heapsize, to allow the heap to grow before
starting to cleanup.
This is because Runtime.freeMemory() returns the amount of freemem using the
current Heapsize, but the heap might be able to grow (default value for
JDK1.2 is 64Mb max).

This means that if you change the allowed max heap size (-Xmx in JDK1.2),
you should ajust these settings. It should be less the the max allowed size.

I think the other params speak for themselves.

I hope this can be useful.

Any comments welcome.

I think a few people (on differents settings) should try this out and play
with different values:
I could only test under JDK1.2.2 on Win98 for the moment, but it should work
with JDK1.1.

Michel.

PS: As I'm a little bit dumb and winCVS is getting me crazy I don't know if
my diff file is OK.
    If not please tell me so (and I'll try to understand a little bit more
of WinCVS).
    Otherwise the complete file is available at
    http://www.outwares.com/cocoon/MemoryStore.java



Mime
View raw message