lua-users home
lua-l archive

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


Patrick Donnelly wrote:
> static void *my_Alloc(void *ud, void *ptr, size_t osize, size_t nsize)
> {
>   (void) ud;
>     if (nsize == 0)
>     {
>       mem_used -= osize;
>       free(ptr);
>       return NULL;
>     }
>     else if (nsize + mem_used > limit)
>       return NULL;
>     else
>     {
>       mem_used += nsize;
>       return realloc(ptr, nsize);
>     }
> }

Don't you want

  mem_used += (nsize - osize);

in the last else block?

Doug

-- 
Innovative Concepts, Inc. www.innocon.com 703-893-2007 x220