Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

Let thread wait till memory is available

Thread view: 
senges - 10 May 2007 14:39 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.