Finding available memory without shell, how to use hasMemory() - Found word(s) list error in the Text body

Bob Sneidar bobsneidar at iotecdigital.com
Thu Feb 27 19:48:30 EST 2014


Gabriel, if you are saving to the boot volume and getting dow to 100MB, this is a very serious matter. You should *never* go below 10 gigs on a modern boot driveIf the volume is being used for a swap file, it’s not as serious but will affect performance. Just a heads up.

Bob


On Feb 26, 2014, at 11:21 , Gabriel Johnson <gwjapp at gmail.com> wrote:

> Thanks for the responses. Yes, we are saving a 100+ MB data file to disk,
> and when the free memory gets to be under 100 MB, saving to a standard hard
> drive (not SSD) sometimes ends up taking a very long time (in Mac OS X),
> making it appear to the user that the program has locked up. We have
> contemplated going about this a different way, but the quickest fix for us
> at the moment is to catch low memory situations.
> 
> Mark: Yes, we need to know the amount of free ram (without counting the
> swap/inactive memory).
> 
> 
> Gabe Johnson
> gwjapp at gmail.com
> 603-978-9881
> 
> 
> On Sun, Feb 23, 2014 at 9:09 PM, Mark Wieder <mwieder at ahsoftware.net> wrote:
> 
>> Gabriel-
>> 
>> Thursday, February 20, 2014, 11:07:59 AM, you wrote:
>> 
>>> Hey All,
>> 
>>> I am working on a program where I need to know the amount of available
>>> memory.
>> 
>>> I'm running on OS X and hasMemory() appears to return true/false for the
>>> same values regardless changes to free/available memory. Is there some
>>> trick to getting hasMemory() to correspond with the actual available
>>> memory? Is this possibly something that is being addressed in newer
>>> versions of LiveCode?
>> 
>> Ah, the curse of modern operating systems...
>> 
>> What the hasMemory() function does is allocate and then free the
>> specified amount of memory, and then returns a boolean telling whether
>> it was successful. However, before doing that, it casts the desired
>> amount as a uint4, which limits the amount to 2147483647. If you're
>> trying to see if more than 2G of memory is available, that won't help.
>> And because modern operating systems will very happily exchange chunks
>> of memory out to swap files when necessary, it's unlikely that you'll
>> see the malloc fail, and thus you should see a "true" return value.
>> 
>> Are you doing something where you really need to see the actual free
>> ram without the swap/inactive memory? The "available" term here is a
>> bit ambiguous, and depends on your needs.
>> 
>> --
>> -Mark Wieder
>> ahsoftware at gmail.com
>> 
>> This communication may be unlawfully collected and stored by the National
>> Security Agency (NSA) in secret. The parties to this email do not
>> consent to the retrieving or storing of this communication and any
>> related metadata, as well as printing, copying, re-transmitting,
>> disseminating, or otherwise using it. If you believe you have received
>> this communication in error, please delete it immediately.
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list