From: Theo Buehler Subject: Re: bgpd: basic stats for bitmaps To: tech@openbsd.org Date: Thu, 5 Mar 2026 06:27:49 +0100 On Wed, Mar 04, 2026 at 05:54:43PM +0100, Claudio Jeker wrote: > This adds some stats for the use of bitmaps. > > Only account for the extended bitmaps that allocate extra memory. > So the count may be much lower since up to 127 bits the map uses > the struct itself for storage. > > It would be nice to also account for the embedded bitmaps but the API > makes it hard to correctly do the accounting. Also it is unclear if that > will gain us much more information. Yeah, that looks a bit tricky. It's a step forward anway. ok tb > +static void > +bitmap_free(struct bitmap *map) > +{ > + uint64_t *ptr; > + uint32_t max; > + > + if (map->data[0] & 0x1) { > + bitmap_getset(map, &ptr, &max); > + bitmap_size -= max / 8; > + bitmap_cnt--; > + free(ptr); > + } > + I'd remove this extra empty line > +} > +