<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Allocates enough memory for a required capacity</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="class.ds-stack.html">Stack</a></div> <div class="next" style="text-align: right; float: right;"><a href="ds-stack.capacity.html">Ds\Stack::capacity</a></div> <div class="up"><a href="class.ds-stack.html">Stack</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="ds-stack.allocate" class="refentry"> <div class="refnamediv"> <h1 class="refname">Ds\Stack::allocate</h1> <p class="verinfo">(PECL ds >= 1.0.0)</p><p class="refpurpose"><span class="refname">Ds\Stack::allocate</span> — <span class="dc-title">Allocates enough memory for a required capacity</span></p> </div> <div class="refsect1 description" id="refsect1-ds-stack.allocate-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>Ds\Stack::allocate</strong></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$capacity</code></span> )</div> <p class="para rdfs-comment"> Ensures that enough memory is allocated for a required capacity. This removes the need to reallocate the internal as values are added. </p> </div> <div class="refsect1 parameters" id="refsect1-ds-stack.allocate-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <code class="parameter">capacity</code></dt> <dd> <p class="para"> The number of values for which capacity should be allocated. </p> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> Capacity will stay the same if this value is less than or equal to the current capacity. </p> </p></blockquote> </dd> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-ds-stack.allocate-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> No value is returned. </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="class.ds-stack.html">Stack</a></div> <div class="next" style="text-align: right; float: right;"><a href="ds-stack.capacity.html">Ds\Stack::capacity</a></div> <div class="up"><a href="class.ds-stack.html">Stack</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>