[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Can userdate have references to lua objects?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 19 May 2003 13:04:54 -0300
> If an object were accessible ONLY by Weak links and the GC continually
> refused to collect that object then would you consider that a "Memory
> Leak"...
No. From the point of view of a language implementer, the definition of
memory leak is a fail to reclaim memory that is no longer acessible from
the root set. That is the definition that any memory-leak detector tool
uses (e.g., valgrind says: "Memory leaks -- where pointers to malloc'd
blocks are *lost forever*" [my emphasis]). Definitions like "fail to
reclaim memory that the program no longer needs" are very nice, but
mostly useless from a language point of view (as it implies that no
language with dynamic memory can prevent memory leaks).
> or at least an "undesirable behaviour"?
If the manual states that "if the only references to an object are
weak references, then the garbage collector will collect that object",
I would consider that a bug. Otherwise it would be an "undesirable
behaviour" (that is, something that could be improved in a future
version, given an adequate algorithm).
-- Roberto