In article <b2428d7e-ec70-268b-0dc4-cdd59ea36...@m00nbsd.net>, Maxime Villard <m...@m00nbsd.net> wrote: >Le 29/11/2018 à 19:51, Christos Zoulas a écrit : >> In article <20181129174012.9ad90f...@cvs.netbsd.org>, >> Maxime Villard <source-changes-d@NetBSD.org> wrote: >>> -=-=-=-=-=- >>> >>> Module Name: src >>> Committed By: maxv >>> Date: Thu Nov 29 17:40:12 UTC 2018 >>> >>> Modified Files: >>> src/sys/compat/linux/common: linux_misc_notalpha.c >>> src/sys/kern: kern_time.c >>> >>> Log Message: >>> Improve my kern_time.c::rev1.192, systematically clear the buffers we get >>>from 'ptimer_pool' to prevent more leaks. >> >> Shouldn't those pools be converted to pool_cache_*() so that we can use >> constructors to avoid sprinking memset() all over the place? >> >> christos > >I thought about it, but I ended up telling myself that it was better not to >completely modify the allocator just add a memset constructor, and that it >was easier to add the memset after the allocation rather than inside. > >The pool is just called three times, so it's not a big deal.
I don't know, from reading the manual page using the pool_cache_ api seems to be the preferred way... Plus I don't think that a language deficiency should be visible in many places in the code (these memsets appear unnecessary) and if we do them using the pool_cache code we pay the cost once (at construction), not every use (however minor that cost is). christos