[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Are there some potential problems if I use a self-defined memory acquirement function instead of realloc(3) in the l_alloc function?
- From: 孙世龙 sunshilong <sunshilong369@...>
- Date: Tue, 11 Aug 2020 10:19:32 +0800
>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.