FFM API allocation shootout

Brian S O'Neill bronee at gmail.com
Wed Aug 2 17:21:09 UTC 2023


On 2023-08-02 10:09 AM, Maurizio Cimadamore wrote>
> Such a simple counter could be realized efficiently using a LongAdder 
> that is increased for each newly allocated MS/BB.
> 
> But, connecting this to what you were saying before, even calling 
> LongAdder::add has a cost - if the application is already tracking 
> memory its own way, one might question as to why we're "wasting time" 
> updating this other counter that the app doesn't really care about?
> 

It's not just an issue of "wasting time", but about practicality. If a 
native library is managing allocation on its own, I wouldn't expect it 
to call into Java to update a counter. If it provides access to 
allocation stats, then a corresponding JMX counter should be able to 
access these stats directly. Otherwise, I'd need to have some sort of 
background task which is periodically keeping the stats and counter 
value in sync.


More information about the panama-dev mailing list