Kay Ramme - Sun Germany - Hamburg wrote:
Stephan Bergmann wrote:
Joerg Budischewski wrote:
[...]
The java uno bridge need to create also a fresh thread for each
release (or at least for each concurrent release). It can't be a
single thread doing the releases, because this would end in the same
problem.
A single additonal thread is enough to avoid the deadlock (thread A
needs more memory, and thus the finalizer thread, but the finalizer
thread waits for a mutex locked by thread A).
That's what I said :-).
On top of that, since the amount of memory available to a JVM is
finite, it is important to keep the number of reachable objects within
a JVM small at every point in time. Whether adding a single thread or
multiple threads in the given case helps achieve this goal better is
not a matter of correctness, but a matter of fine tuning.
Don't understand, what would be the difference between one or multiple
release threads?
OutOfMemoryError in a JVM happens because (1) too many objects are
reachable at a given point in time, or (2) the finalizer is blocked, so
that otherwise reclaimable garbage piles up.
The problem under discussion is 2. If we solve it by adding one or
multiple threads, we may run into 1 in different ways (e.g., if we have
only one thread to do the releases, that thread may block and its queue
may grow too large; if we have multiple threads, it is unlikely that all
of them block at the same time, etc.).
IMO, the simplest approach should be tried first. Only if it is known
to behave badly (i.e., lead to OutOfMemoryError) often enough a more
complex approach should be tried.
Like always :-)
The simplest approach (call release synchronously from the finalizer
thread) is known to deadlock. It is arguable whether that deadlock is
due to an error in the bridge, or due to an error in the involved UNO
object implementations. However, if we agree on the former, the next
approach in terms of simplicity would be to have exactly one extra
thread.
[...]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]