Garbage collection (crashing on Windows)

Richard Gaskin ambassador at fourthworld.com
Thu Aug 18 09:16:04 EDT 2016


Ben Rubinstein wrote:
> Please refresh my memory: is there any way to cause/allow garbage to be
> collected without ending all script running?
>
> I have an app which process large amounts of data. It runs fine on Mac, but on
> Windows intermittently (but not frequently as the application data source,
> which fluctuates, is gradually increasing) as the total memory in use
> approaches 2GB, the app faults.
>
> Obviously this is very distressing for me and my client, because the app has
> lost control at this point and can't even tell us what's happening (it
> normally runs on a schedule on a VM, so it often takes days to discover that
> the system downstream hasn't been updated for a while, and trace back to find
> that the LC app is halted).
>
> I have managed to reduce the incidence of this by breaking the processing into
> two parts, but this is undesirable for various reasons, and only palliative.
> What I really want is a way for my main function to invoke garbage collection
> after calling some of the larger processing steps.
>
> Is there any way to do this? Am I right in thinking that the issue is related
> to LC's total memory usage reaching 2GB on Windows? Are there any useful
> functions (e.g. the "hasMemory" function is documented as "only partially
> implemented, and may not return useful values on some platforms", which makes
> it seem pretty pointless...)?

LC's hasMemory function was useful in Mac Classic where it was first 
introduced to the xTalk world in SuperCard, but with modern memory 
management it would be difficult if not impossible to try to make it 
work as it used to, allowing an app to modify the system's control of 
memory.

Monte's tips were great (thanks Monte, love learning engine details like 
that!), but since memory is only problematic on Windows but not Mac, I 
wonder if this may be merely a leak that could be fixed?

Are you deleting variables when they're no longer needed?  Does 
introducing a periodic idle help?

Can you tell us a bit about what the app is working on, particularly the 
size of the data and what it's doing with it?

If it's a leak we should be able to hone in on what's causing it.  And 
if it's an expected behavior that needs tailoring for your algo, I'll 
bet we can find a way to make it work as well on Win as it does on Mac.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list