hi all,
a basic question:
i have a memory consuming encoding process which runs in its own
thread.
To preseve OutOfMemory errors when a lot of those treads are running,
i want this thread to check the current memory heap, and maybe wait as
long as there's some available.
Is that possible ?
I think this must be a very common problem in thread programming?
Greets,
chris
Ingo R. Homann - 10 May 2007 14:44 GMT
Hi,
> hi all,
> a basic question:
[quoted text clipped - 8 lines]
> Is that possible ?
> I think this must be a very common problem in thread programming?
You may take a look at java.lang.Runtime.free/max/totalMemory.
Hth,
Ingo
Robert Klemme - 10 May 2007 14:49 GMT
> Hi,
>
[quoted text clipped - 12 lines]
>
> You may take a look at java.lang.Runtime.free/max/totalMemory.
Other options are to start and catch any OOM errors. Or use a thread
pool with limited size to limit concurrent processing.
Kind regards
robert
Ingo R. Homann - 10 May 2007 14:59 GMT
Hi,
>>> hi all,
>>> a basic question:
[quoted text clipped - 12 lines]
>
> Other options are to start and catch any OOM errors.
But that might crash other threads (with low mem usage) with an OOME as
well!
> Or use a thread
> pool with limited size to limit concurrent processing.
OK.
Ciao,
Ingo