On 8 Oct 2001, at 17:55, Henrik Nordstrom <hno@marasystems.com> wrote:
> To answer your question: To make sure the the caller knows what he/she
> is freeing. The size field sent to memFreeBuf is the same field as
> returned via gross_size in memAllocBuf.
 ok, so correct way would be to add TLV a field of gross_size as returned
 by memAllocBuf.
 I've been thinking that it'd be handy to have anonymous Pool for variable
 sized allocs. Thought memAllocBuf would do it in this case.
> A related questions is:
> 
> Why do we have 2 different and incompatible buffer implementations?
> 
> MemBuf
> String
 I thought to make distinction between data buffers and strings.
 It seems that thats not the case anymore.
> The two provide basically the same functionality with only some minor
> twists. The main difference is the buffer sizes.
> 
>   String uses the memBufAlloc/Free API to manage 36 bytes, 128 bytes,
> 512 bytes and xmallocs anything larger.
> 
>   MemBuf manages 2K, 4K, 8K, 16K, 32K, 64K buffers using the MEM_xK_BUF
> mempools, and xmallocs anything larger.
> 
> I have a feeling that the use of these two is not entirely consistent. 
> 
> Regards
> Henrik
> 
> 
> Andres Kroonmaa wrote:
> 
> >  ok,
> > 
> >  Any good reason why we insist on size to be exactly size of
> >  pool's obj_size?
> > 
> > /* free buffer allocated with memAllocBuf() */
> > void
> > memFreeBuf(size_t size, void *buf)
> > {
> >     int i;
> >     MemPool *pool = NULL;
> >     assert(size && buf);
> >     for (i = 0; i < mem_str_pool_count; i++) {
> >         if (size <= StrPoolsAttrs[i].obj_size) {
> > >>>         assert(size == StrPoolsAttrs[i].obj_size);
> >             pool = StrPools[i].pool;
> >             break;
> >         }
> >     }
> >     memMeterDec(StrCountMeter);
> >     memMeterDel(StrVolumeMeter, size);
> >     pool ? memPoolFree(pool, buf) : xfree(buf);
> > }
> > 
> > ------- End of forwarded message -------
> > 
> > ------------------------------------
> >  Andres Kroonmaa <andre@online.ee>
> >  CTO, Microlink Online
> >  Tel: 6501 731, Fax: 6501 725
> >  Pärnu mnt. 158, Tallinn,
> >  11317 Estonia
------------------------------------
 Andres Kroonmaa <andre@online.ee>
 CTO, Microlink Online
 Tel: 6501 731, Fax: 6501 725
 Pärnu mnt. 158, Tallinn,
 11317 Estonia
Received on Mon Oct 08 2001 - 10:27:38 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:26 MST