harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Deakin <oliver.dea...@googlemail.com>
Subject Re: [classlib] OSResourceMonitor must go
Date Thu, 01 Oct 2009 09:09:32 GMT
Yep, +1 from me as well - this code is too hacky and costly for each malloc.

Regards,
Oliver

Mark Hindess wrote:
> Harsh but fair.  I'm +1 for removing it.  It is a shame there isn't a public
> API but this problem should be handled by applications.
> -Mark.
>
> In message <4AC46E87.3040604@gmail.com>, Tim Ellison writes:
>   
>> 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
>>
>>     
>
>
>
>   

-- 
Oliver Deakin
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU


Mime
View raw message