Garbage collection (crashing on Windows)
Mark Waddingham
mark at livecode.com
Mon Sep 5 10:00:34 EDT 2016
On 2016-08-22 14:47, Ben Rubinstein wrote:
>> https://blogs.technet.microsoft.com/askperf/2007/03/23/memory-management-demystifying-3gb/
> This looks like a great tip - before I go into the ring with the
> client's IT dept (always a tricky exercise) can I just check that
> LiveCode does have the IMAGE_FILE_LARGE_ADDRESS_AWARE flag set in the
> image header as described in that article? And do you know from which
> version that is true?
That is a good question... It probably isn't (looking at the linker
flags) - however you can set it on your standalone exe yourself:
http://stackoverflow.com/questions/1346480/how-to-make-a-net-application-large-address-aware
I'm pretty sure the LC codebase will be fine for use under this mode
although it hasn't been explicitly tested.
> But does 'freed' literally release the memory, or just mark the object
> as available? Surely you still need to do some kind of garbage
> collection in order to collapse what may be isolated fragments of
> 'free' memory?
When a value is no longer referenced, the area(s) of memory occupied by
it are returned to the heap for future allocation. Note that LiveCode
relies on the standard memory management functions (malloc / free) on
the various OSes - they handle any coalescing of free regions (and
handing unused pages back to the OS - some OSes are better at this than
others).
> How can we do this? As noted hasMemory is defunct; heapSpace is Mac
> only; is there a method I can use to profile the memory usage?
On Mac there is - yes. The 'heap' command line tool lets you poke
another process for its current memory usage (what is and isn't
allocated in the C heap). On Windows, I think ProcExplorer can do a
similar thing -
https://technet.microsoft.com/en-us/sysinternals/processexplorer.aspx
(if not I'm almost 100% certain there is a sysinternals tool which
*does* give the usage information of any C heaps - win apps can have
more than one - allocated by a process).
Hope this helps,
Warmest Regards,
Mark.
--
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps
More information about the use-livecode
mailing list