On 2009-12-16 03:01 PST, Konstantin Andreev wrote: > I see NSS code uses SECITEM_AllocItem() and PORT_Arena{,Z}Alloc() memory > allocation routines almost interchangeably.
Yes, almost. > I see that SECITEM_AllocItem(), basically, just wraps PORT_ArenaZAlloc() > into the "arena mark" brackets: I would not say that is the major difference. The major difference is that SECITEM_AllocItem will optionally allocate the Item, as well as the buffer to which the item points. The use of arena pool marks is merely necessary to ensure proper cleanup in the rare case where the first of those two allocations succeeds but the second fails. If you don't use the optional feature to allocate the Item itself, then calling SECITEM_AllocItem to allocate only the buffer is completely equivalent to calling PORT_ArenaAlloc directly. > Could you, please, advice, which allocation routine (SECITEM_AllocItem or > PORT_Arena{,Z}Alloc) should I use for my particular code ? OK. :) -- dev-tech-crypto mailing list dev-tech-crypto@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-crypto