lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Thu, 2020-08-13 at 11:44 +0800, 孙世龙 sunshilong wrote:
> I see.
> Osize has not been used in the l_alloc() function.
> So I think it's no meaning to pass such arguments(i.e. LUA_TSTRING,
> Am I missing something?

I suppose it is done for user-defined allocators so those can behave
differently for different object types for whatever reason.
Imagine implementation that somehow optimizes allocations for specific
data type, e.g. by using few memory pools with different block sizes,
or even in different type of memory: tiny and fast memory embedded into
microcontroller vs bigger but slower one connected to it externally.

Just because this is not used in default allocator implementation
doesn't mean there are no uses for it in user-defined ones.
v <>