<doc>
  <legacy_id>1039</legacy_id>
  <name>hasMemory</name>
  <type>function</type>
  <syntax>
    <example>the hasMemory of <i>bytes</i></example>
    <example>hasMemory(<i>bytes</i>)</example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>The System Environment</category>
  </classification>
  <references>
    <command tag="revUnloadSpeech">revUnloadSpeech Command</command>
    <function tag="stackSpace">stackSpace Function</function>
    <function tag="heapSpace">heapSpace Function</function>
    <function tag="diskSpace">diskSpace Function</function>
    <property tag="freeSize">freeSize Property</property>
    <property tag="alwaysBuffer">alwaysBuffer Property</property>
    <property tag="destroyStack">destroyStack Property</property>
    <property tag="size">size Property</property>
  </references>
  <history>
    <introduced version="1.0">Added.</introduced>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
    <ios/>
    <android/>
  </platforms>
  <classes>
    <desktop/>
    <server/>
    <web/>
    <mobile/>
  </classes>
  <security>
  </security>
  <summary><glossary tag="return">Returns</glossary> true if the specified amount of memory is available, false otherwise.</summary>
  <examples>
    <example>hasMemory(2*1024*1024) <code><i>-- returns true if 2M available</i></code></example>
    <example>if hasMemory(500*1024) then open stack "Explore Multimedia"</example>
  </examples>
  <description>
    <p>Use the <b>hasMemory</b> <control_st tag="function">function</control_st> to check whether there's enough memory available for an action (such as displaying a large <keyword tag="graphic">graphic</keyword>) before you do it.</p><p/><p><b>Parameters:</b></p><p>The <i>bytes</i> is the number of <glossary tag="byte">bytes</glossary> you require. If the amount of available memory is greater than or equal to the <i>bytes</i>, the <control_st tag="function">function</control_st> <glossary tag="return">returns</glossary> true.</p><p/><p><b>Comments:</b></p><p>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.</p><p/><p><code/><img src="202652"/> <b>Cross-platform note:</b><code/> On <glossary tag="Mac OS">Mac OS systems</glossary>, the <function tag="value">value</function> <glossary tag="return">returned</glossary> 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 <b>hasMemory</b> <control_st tag="function">function</control_st> <glossary tag="return">returns</glossary> false, there may be enough system memory available for the task, since LiveCode uses temporary memory when necessary.</p>
  </description>
</doc>