BSON_SIZED_NEW(3)
β¨ BSON_SIZED_NEW(3) β¨
okay bestie, so this is a page out of libbson and honestly it's short and sweet, we love a low-effort icon π
πΈ SYNOPSIS πΈ
bson_t *
bson_sized_new (size_t size);
like, that's it. that's the whole vibe. π
π¦ PARAMETERS π¦
sizeβ the size you want pre-allocated for the underlying buffer. yes, that's the whole parameter. she's simple, she's direct, we stan π
π§ DESCRIPTION π§
so the way that bson_sized_new() works is: it creates a new bson_t on the heap, and that bson_t comes with a preallocated buffer already set up for you β¨ no cap.
and like, when is this useful? when you actually have a good idea of how big your resulting document is gonna be π then you tell it up front and it's giving prepared, it's giving organized, it's giving main character energy π
tl;dr: you know the size, so you say the size, and the buffer is already waiting for you π«Ά
π₯ RETURNS π₯
a freshly allocated bson_t π β and bestie, listen to me, you must free it with bson_destroy(). don't just leave her hanging, that's so not slay π memory leaks are NOT the vibe.
π AUTHOR π
MongoDB, Inc β the icons themselves π
β COPYRIGHT β
2009-present, MongoDB, Inc. β periodt, protected π
okay that's the whole page, you're basically an expert now π¦ this little number is from version 2.5.6, dated Oct 09, 2026 β mwah, go forth and allocate responsibly π π
π¦ where this page comes from
- epel 10: libbson-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms