How to calculate used shared memory in slab?

nobody junk at slact.net
Wed Aug 17 21:36:00 UTC 2016


Hello, I'm the developer of Nchan (previously known as the http push
module) -- https://github.com/slact/nchan. I'm writing a stub_status -
like stats output handler, and I want to output the amount of shared
memory actually used. I could keep track of the raw bytes allocated with
wrappers to ngx_slab_alloc, but that does not produce accurate numbers
because the slab allocator works on pages.

I'm having some trouble understanding the internal working of the slab
allocator. Is there a straightforward way to get the number of pages
currently in use?


Thanks,
    Leo



More information about the nginx mailing list