discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use of NSZoneStat()


From: David Chisnall
Subject: Re: Use of NSZoneStat()
Date: Fri, 9 Mar 2018 10:07:06 +0000

On 8 Mar 2018, at 17:57, amon <amon@vnl.com> wrote:
> 
> Based on the hint, I found that the current malloc has gained
> some tools that were not there the last time I had to do this,
> and in fact it looks like mallinfo(3) might even be the base
> upon which NSZoneStats() was built. So I might be able to whip
> up a Linux ZoneStats() that uses NSZoneStats if zone != default
> and glues in the values from mallinfo into an struct NSZoneStats,
> which would give me a much more generally useful tool.

Note that mallinfo is not a ‘linux’ thing, it is a dlmalloc thing.  Most 
GNU/Linux distros use dlmalloc as their default malloc but Android, for 
example, does not, and a few musl-based distros also use jemalloc, as do some 
programs (e.g. Firefox) on all GNU/Linux platforms.  jemalloc also has a 
(somewhat richer) set of debugging features, but these are exposed via 
different interfaces.

On Darwin, NSZone is implemented on top of the malloc_zone functionality in 
their malloc, which provides a structure that looks quite similar to GNUstep’s 
NSZone structure (though has a few other functions, for example one for 
allocating a large number of identical blocks simultaneously).  I have never 
seen any code that uses malloc_zone, but I believe that Apple uses it 
internally for a few things where direct control over memory management is 
important for performance.

David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]