[tarantool-patches] Re: [PATCH 1/1] core: introduce tt_static_sized_buf()

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sun Apr 28 19:56:33 MSK 2019



On 28/04/2019 00:18, Konstantin Osipov wrote:
> * Vladislav Shpilevoy <v.shpilevoy at tarantool.org> [19/04/27 15:39]:
> 
> To solve your particular problem, you could simply increase the
> static buffer size. This is a one-line patch. I suggest you do it
> in scope of swim and be done with it.
> 
> Here is why:
> 
> Essentially, you introduce a new allocator. A very useful one,
> indeed, but the protocol should follow one of an allocator, e.g.
> provide alloc, realloc, and a (no-op) free. The allocator itself
> should be moved to small/. You should check boundary conditions -
> e.g. attempt to allocate more memory than the maximal size of the
> static array - and return 0. tt_static_buf() then can be replaced
> with static_alloc(desired size).
> 
> If you wish to do all of the above in a separate patch - you're
> more than welcome.

I did, see the new mail thread. But I did not realloc() nor free().
Realloc() just is not needed. Free() would cause too huge changes
in the code, because every single tt_sprintf and tt_static_buf would
require free() - it would be tremendous diff.

> 
> 
> -- 
> Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
> 




More information about the Tarantool-patches mailing list