lua-users home
lua-l archive

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


Am Mi., 16. Nov. 2022 um 20:13 Uhr schrieb Sean Conner <sean@conman.org>:
>
> > I believe this (and the below) is a problem because Lua code should not be
> > able to make C libraries leak resources.
>
>   So several years ago, a program I wrote for work would, in certain
> circumstances, not release a (at the time) strong reference to some value,
> so over time, the long running server would "leak" memory.  Was Lua at
> fault?  Or my code?  The Lua code was able to make C libraries
> (specifically, malloc()) leak resources.

Seen from my side, if you do not control malloc, this was somehow your
own fault.

I think every safe Lua application should check the Lua program for
"dangerously large malloc consumption", as well as also for "infinite
while loops" or similar.

... at least if you are programming in embedded systems / restricted
RAM systems, this would be a clear priority.

Lua does not seem to support internal malloc checking, maybe to allow
also for maximum speed... . But it would be quite nice if they would
at least present a macro in luaconf.h, which could be easily exchanged
by some "malloc surveillance code" (which is really easy, see my
malloc check post last week...).