From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 912952B7FE for ; Sun, 28 Apr 2019 12:56:36 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XKaTYg8nC7nQ for ; Sun, 28 Apr 2019 12:56:36 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 520952B7DA for ; Sun, 28 Apr 2019 12:56:36 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH 1/1] core: introduce tt_static_sized_buf() References: <687f8dc3342a3e9b6d8138837646837d60e63ed8.1556315009.git.v.shpilevoy@tarantool.org> <20190427211803.GC5662@atlas> From: Vladislav Shpilevoy Message-ID: <0f812547-b60b-7927-7a27-f79a3fbe5b95@tarantool.org> Date: Sun, 28 Apr 2019 19:56:33 +0300 MIME-Version: 1.0 In-Reply-To: <20190427211803.GC5662@atlas> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org, Konstantin Osipov On 28/04/2019 00:18, Konstantin Osipov wrote: > * Vladislav Shpilevoy [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 >