LC Garbage Collection?
Dar Scott Consulting
dsc at swcp.com
Tue Sep 24 15:39:36 EDT 2019
I don't know where you will find details. (Maybe if we keep this conversation going, we will get a response in a half day.)
I believe it is reference-counting with lazy cleanup for high-level objects, but with carefully crafted destructors for low level objects. Because of the lazy cleanup, it is sometimes hard to see when memory problems occur or to infer GC behavior
But, to me it doesn't matter. I like the memory management of LiveCode. It cleans up. It doesn't have astonishingly-long pauses that I remember. It would be nice to know that cleanup is not delayed forever, though, and for that I am not sure. I have only run into memory problems with some ML projects, so my experience might not shed much light.
Sources of memory leaks are LC, LC scripts, OS, libraries, LCB and (I suppose) compilers. I don't think we can assume the problem is not in the user script. I have seen script memory leaks like these:
1. Leaving large data in script locals
2. Indefinite log variables
3. Poor range checking in recursive functions
4. mouseUp recursion*
5. Queue/stack bugs
6. Bad parsing
*GUI recursion is a root of all kinds of evil. If tempted, leave your cloak and run.
> On Sep 24, 2019, at 12:36 PM, Tom Glod via use-livecode <use-livecode at lists.runrev.com> wrote:
> Hi folks, I'm wondering if anyone can help me to understand Livecode's
> garbage collection. I am developing an application that is intended to
> stay in memory and so I must watch memory consumption carefully. I've had
> some instances where memory ran way out of control.... but I found a couple
> of reasons for that...... one of them being the dozen or so memory leaks
> that were fixed in 9.05.
> When I build the standalone in 9.04 its a disaster. When I build with 9.05
> I am very impressed with my application clearing its own memory..... even
> to the point where it consumes less than what it does when the standalone
> first starts up
> But it seems arbitrary. Where can I go to find out more details about the
> engine's GC?
> Tom Glod
> Founder & Developer
> MakeShyft R.D.A (www.makeshyft.com)
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode