[Tarantool-patches] [PATCH luajit v2 2/5] memprof: remove invalid assertions

Sergey Bronnikov sergeyb at tarantool.org
Mon Jul 24 13:46:04 MSK 2023


Thanks for the patch! LGTM

On 7/21/23 11:12, Igor Munkin wrote:
> The assertions checking the state of the allocator, being replaced by
> memory profiler, against NULL can fail if this allocator requires no
> internal state (e.g. glibc functions for allocating dynamic memory). In
> fact, when building LuaJIT with LUAJIT_USE_SYSMALLOC option enabled,
> NULL is given as the second parameter to <lua_newstate> and these
> assertions fail as a result. Hence, they are simply removed.
>
> Follows up tarantool/tarantool#5442
> Needed for tarantool/tarantool#5878
>
> Signed-off-by: Igor Munkin <imun at tarantool.org>
> ---
>   src/lj_memprof.c | 2 --
>   1 file changed, 2 deletions(-)
>
> diff --git a/src/lj_memprof.c b/src/lj_memprof.c
> index 8cab8204..c600c4f0 100644
> --- a/src/lj_memprof.c
> +++ b/src/lj_memprof.c
> @@ -295,7 +295,6 @@ int lj_memprof_start(struct lua_State *L, const struct lj_memprof_options *opt)
>     oalloc->allocf = lua_getallocf(L, &oalloc->state);
>     lua_assert(oalloc->allocf != NULL);
>     lua_assert(oalloc->allocf != memprof_allocf);
> -  lua_assert(oalloc->state != NULL);
>     lua_setallocf(L, memprof_allocf, oalloc->state);
>   
>     return PROFILE_SUCCESS;
> @@ -328,7 +327,6 @@ int lj_memprof_stop(struct lua_State *L)
>   
>     lua_assert(memprof_allocf == lua_getallocf(L, NULL));
>     lua_assert(oalloc->allocf != NULL);
> -  lua_assert(oalloc->state != NULL);
>     lua_setallocf(L, oalloc->allocf, oalloc->state);
>   
>     if (LJ_UNLIKELY(lj_wbuf_test_flag(out, STREAM_STOP))) {


More information about the Tarantool-patches mailing list