Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: Java program "debugging" itself... Date: Thu, 2 Jun 2016 22:24:59 +0200 Lines: 31 Message-ID: References: <98c956a8-ae76-415d-9347-2c7ff4e1775a@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net yV46c36EiRCbNwwGo0HO7gBzAAud4bAK3NSx4nKv3Ry+WErVU= Cancel-Lock: sha1:+Qip+Pt72mTMTHZq0RgA5kGK6bU= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:34446 On 02.06.2016 16:38, Eric Sosman wrote: > The problem is a lot like that of Linux' OOM Killer: The task that > hits the limit is not necessarily the task at fault. If a runaway task > gobbles up almost all the memory and then a well-behaved task gets an > OutOfMemoryException on something innocuous like `new int[10]', the > exception is thrown to the "wrong" thread: Not the runaway, but the > innocent bystander. I think this hints straight at an important underlying issue - regardless of whether the option exists that Andreas has asked for: how do you determine the "culprit"? Eric has illustrated one example, here's another one: one thread allocates tens of thousands of int[100] while another thread allocates a single char[10000] hitting a memory limit (or worse, OOM because of fragmentation). Basically it starts with, you would have to keep track of the overall resource consumption of a task or thread. Then define criteria for termination and then you need to find a way to implement that. One approach that comes to mind is JMX: a process can connect to itself and monitor its own activity (btw. "monitor" is a much better term than "debug" for this thread's title). Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/