harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Re: [classlib] OSResourceMonitor must go
Date Thu, 01 Oct 2009 10:29:26 GMT
On 01/Oct/2009 11:00, Alexey Petrenko wrote:
> +1 from me as well.
> Actually I was against this patch from the very beginning since it's useless.
> Here is the original JIRA issue:
> http://issues.apache.org/jira/browse/HARMONY-3148

Thanks Alexey.  It has gone now -- so we are all happy again :-)


> 2009/10/1 Tim Ellison <t.p.ellison@gmail.com>:
>> I propose that the OSResourceMonitor abomination is removed.  It sits in
>> front of our OSMemory.malloc() calls to check there is enough system memory.
>> First, it is going to make all our regular mallocs (from Java) slow by
>> making these extra JNI + system calls.  At least it should be written to
>> kick-in when an OOM exception is thrown, not on every call!
>> Second, it is there IIRC to attempt to solve the problem of NIO direct
>> byte buffers.  I'm not convinced it will do a good job of that --
>> invoking System.gc() in a loop is hopeful at best, and again taxing
>> every call to malloc up from for this is unreasonable.
>> The current situation is a hack to work around the lack of public API to
>> free a direct byte buffer.  There is a far better hack available, and
>> that is for apps to cast down and call free explicitly, i.e.
>> ((DirectByteBuffer)myBuffer).free()
>> Regards,
>> Tim

View raw message