Re: [bug] MemBuf and using as string

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Tue, 16 Apr 2002 21:33:15 +0200

Alex Rousskov wrote:

> Historical note: IIRC, from user perspective, the old pools cleared
> memory when allocating it to the user. Thus, if one wants new buffers
> clean, the code did not waste CPU cycles.

Correct. Everything you allocate from a MemPool is guaranteed to be clean,
and most often one wants this.

> The implementation cleared memory "earlier", when the buffer was
> returned by the user, to also detect use-after-free cases.
>
> The same trick to save CPU cycles and kill two birds with one stone
> does not work if you want to have a mix of [expensive] clean and
> [cheap] dirty buffers.

Exacly. Fortunately there is no need to mix clean/unclean buffers in the same
pool. The types of objects where unclean is acceptable is distinctively
different from the rest.

Regards
Henrik
Received on Tue Apr 16 2002 - 13:33:21 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:15:11 MST