Returns true if the specified amount of memory is available, false otherwise.

Built-in Function handler[edit | edit source]

Syntax:

hasMemory(<bytes>)

Examples:

hasMemory(2*1024*1024) -- returns true if 2M available
if hasMemory(500*1024) then open stack "Explore Multimedia"

Use the hasMemory function to check whether there's enough memory available for an action (such as displaying a large graphic) before you do it.

This function is only partially implemented, and may not return useful values on some platforms. It is included in LiveCode for compatibility with imported SuperCard projects.

On Mac OS systems, the value

returned depends on the amount of free memory in the application heap and does not take available temporary memory into account. This means that even if the hasMemory function returns false, there may be enough system memory available for the task, since LiveCode uses temporary memory when necessary.

Parameters:

  • bytes: The number of bytes you require. If the amount of available memory isgreater than or equal to the bytes, the function returns true.

See also: heapSpace (function),stackSpace (function),value (function),diskSpace (function),size (property),destroyStack (property),alwaysBuffer (property),freeSize (property),

Community content is available under CC-BY-SA unless otherwise noted.