lua-users home
lua-l archive

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


>Lua relies on the behaviour that the realloc-like function
>does not return a different pointer (copy) for shrinking an existing
>block.
What problems may occur if this rule(or advice) is broken?

On Mon, Aug 10, 2020 at 8:34 PM Stefan <ste@evelance.de> wrote:
>
> Am 10.08.2020 um 10:32 schrieb 孙世龙 sunshilong:
> > Hi, list
> >
> > I want to use a self-defined memory acquirement function instead of
> > using realloc(3) in the l_alloc function.
> > Since I am a newbie, I don't know if there are some potential problems.
> > Could somebody shed some light on this problem?
> > Thank you for your attention to this matter.
>
> I think Lua relies on the behaviour that the realloc-like function
> does not return a different pointer (copy) for shrinking an existing
> block. Maybe that could be a problem for some allocators.