blob: 2d81e7a5a7bf72f9c228cd13c7199e39695a0706 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_102) on Thu Jan 19 09:32:43 PST 2017 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>AllocMemory (com.yahoo.datasketches:memory 0.8.5-SNAPSHOT API)</title>
<meta name="date" content="2017-01-19">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="AllocMemory (com.yahoo.datasketches:memory 0.8.5-SNAPSHOT API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../com/yahoo/memory/package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/AllocMemory.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev&nbsp;Class</li>
<li><a href="../../../com/yahoo/memory/Memory.html" title="interface in com.yahoo.memory"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?com/yahoo/memory/AllocMemory.html" target="_top">Frames</a></li>
<li><a href="AllocMemory.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.com.yahoo.memory.NativeMemory">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.yahoo.memory</div>
<h2 title="Class AllocMemory" class="title">Class AllocMemory</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../com/yahoo/memory/NativeMemory.html" title="class in com.yahoo.memory">com.yahoo.memory.NativeMemory</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../com/yahoo/memory/MemoryMappedFile.html" title="class in com.yahoo.memory">com.yahoo.memory.MemoryMappedFile</a></li>
<li>
<ul class="inheritance">
<li>com.yahoo.memory.AllocMemory</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../com/yahoo/memory/Memory.html" title="interface in com.yahoo.memory">Memory</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="typeNameLabel">AllocMemory</span>
extends <a href="../../../com/yahoo/memory/MemoryMappedFile.html" title="class in com.yahoo.memory">MemoryMappedFile</a></pre>
<div class="block">The AllocMemory class is a subclass of MemoryMappedFile, which is a subclass of
NativeMemory<sup>1</sup>. AllocMemory is used to allocate direct,
off-heap memory, which can then be accessed by the NativeMemory methods.
It is the responsibility of the calling class to free this memory using freeMemory() when done.
<p>[1] The task of direct allocation was moved to this sub-class to improve JVM performance of
loading NativeMemory classes that do not use off-heap memory and thus do not require JVM
tracking of the finalize() method. The parent MemoryMappedFile acts only as a pass-through to
NativeMemory. This design allows leveraging the freeMemory() and finalize() methods of the
parents so that these actions occur only in one place for the instance hierarchy.</div>
<dl>
<dt><span class="simpleTagLabel">Author:</span></dt>
<dd>Lee Rhodes</dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="fields.inherited.from.class.com.yahoo.memory.NativeMemory">
<!-- -->
</a>
<h3>Fields inherited from class&nbsp;com.yahoo.memory.<a href="../../../com/yahoo/memory/NativeMemory.html" title="class in com.yahoo.memory">NativeMemory</a></h3>
<code><a href="../../../com/yahoo/memory/NativeMemory.html#byteBuf_">byteBuf_</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#capacityBytes_">capacityBytes_</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#memArray_">memArray_</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#memReq_">memReq_</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#nativeRawStartAddress_">nativeRawStartAddress_</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#objectBaseOffset_">objectBaseOffset_</a></code></li>
</ul>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../com/yahoo/memory/AllocMemory.html#AllocMemory-long-">AllocMemory</a></span>(long&nbsp;capacityBytes)</code>
<div class="block">Constructor for allocate native memory.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../com/yahoo/memory/AllocMemory.html#AllocMemory-long-com.yahoo.memory.MemoryRequest-">AllocMemory</a></span>(long&nbsp;capacityBytes,
<a href="../../../com/yahoo/memory/MemoryRequest.html" title="interface in com.yahoo.memory">MemoryRequest</a>&nbsp;memReq)</code>
<div class="block">Constructor for allocate native memory with MemoryRequest.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../com/yahoo/memory/AllocMemory.html#AllocMemory-com.yahoo.memory.NativeMemory-long-long-com.yahoo.memory.MemoryRequest-">AllocMemory</a></span>(<a href="../../../com/yahoo/memory/NativeMemory.html" title="class in com.yahoo.memory">NativeMemory</a>&nbsp;origMem,
long&nbsp;copyToBytes,
long&nbsp;capacityBytes,
<a href="../../../com/yahoo/memory/MemoryRequest.html" title="interface in com.yahoo.memory">MemoryRequest</a>&nbsp;memReq)</code>
<div class="block">Constructor for allocate native memory, copy and clear.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../com/yahoo/memory/AllocMemory.html#AllocMemory-com.yahoo.memory.NativeMemory-long-com.yahoo.memory.MemoryRequest-">AllocMemory</a></span>(<a href="../../../com/yahoo/memory/NativeMemory.html" title="class in com.yahoo.memory">NativeMemory</a>&nbsp;origMem,
long&nbsp;newCapacityBytes,
<a href="../../../com/yahoo/memory/MemoryRequest.html" title="interface in com.yahoo.memory">MemoryRequest</a>&nbsp;memReq)</code>
<div class="block">Constructor for reallocate native memory.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/yahoo/memory/AllocMemory.html#freeMemory--">freeMemory</a></span>()</code>
<div class="block">This frees this Memory only if it is required.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.com.yahoo.memory.MemoryMappedFile">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;com.yahoo.memory.<a href="../../../com/yahoo/memory/MemoryMappedFile.html" title="class in com.yahoo.memory">MemoryMappedFile</a></h3>
<code><a href="../../../com/yahoo/memory/MemoryMappedFile.html#finalize--">finalize</a>, <a href="../../../com/yahoo/memory/MemoryMappedFile.html#force--">force</a>, <a href="../../../com/yahoo/memory/MemoryMappedFile.html#isLoaded--">isLoaded</a>, <a href="../../../com/yahoo/memory/MemoryMappedFile.html#load--">load</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.com.yahoo.memory.NativeMemory">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;com.yahoo.memory.<a href="../../../com/yahoo/memory/NativeMemory.html" title="class in com.yahoo.memory">NativeMemory</a></h3>
<code><a href="../../../com/yahoo/memory/NativeMemory.html#addAndGetInt-long-int-">addAndGetInt</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#addAndGetLong-long-long-">addAndGetLong</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#array--">array</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#asReadOnlyMemory--">asReadOnlyMemory</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#byteBuffer--">byteBuffer</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#clear--">clear</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#clear-long-long-">clear</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#clearBits-long-byte-">clearBits</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#compareAndSwapInt-long-int-int-">compareAndSwapInt</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#compareAndSwapLong-long-long-long-">compareAndSwapLong</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#copy-long-long-long-">copy</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#copy-com.yahoo.memory.Memory-long-com.yahoo.memory.Memory-long-long-">copy</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#fill-byte-">fill</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#fill-long-long-byte-">fill</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getAddress-long-">getAddress</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getAndSetInt-long-int-">getAndSetInt</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getAndSetLong-long-long-">getAndSetLong</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getBoolean-long-">getBoolean</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getBooleanArray-long-boolean:A-int-int-">getBooleanArray</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getByte-long-">getByte</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getByteArray-long-byte:A-int-int-">getByteArray</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getCapacity--">getCapacity</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getChar-long-">getChar</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getCharArray-long-char:A-int-int-">getCharArray</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getCumulativeOffset-long-">getCumulativeOffset</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getDouble-long-">getDouble</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getDoubleArray-long-double:A-int-int-">getDoubleArray</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getFloat-long-">getFloat</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getFloatArray-long-float:A-int-int-">getFloatArray</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getInt-long-">getInt</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getIntArray-long-int:A-int-int-">getIntArray</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getLong-long-">getLong</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getLongArray-long-long:A-int-int-">getLongArray</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getMemoryRequest--">getMemoryRequest</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getNativeMemory--">getNativeMemory</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getParent--">getParent</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getShort-long-">getShort</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#getShortArray-long-short:A-int-int-">getShortArray</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#hasArray--">hasArray</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#hasByteBuffer--">hasByteBuffer</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#isAllBitsClear-long-byte-">isAllBitsClear</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#isAllBitsSet-long-byte-">isAllBitsSet</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#isAllocated--">isAllocated</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#isAnyBitsClear-long-byte-">isAnyBitsClear</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#isAnyBitsSet-long-byte-">isAnyBitsSet</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#isDirect--">isDirect</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#isReadOnly--">isReadOnly</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#putBoolean-long-boolean-">putBoolean</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#putBooleanArray-long-boolean:A-int-int-">putBooleanArray</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#putByte-long-byte-">putByte</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#putByteArray-long-byte:A-int-int-">putByteArray</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#putChar-long-char-">putChar</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#putCharArray-long-char:A-int-int-">putCharArray</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#putDouble-long-double-">putDouble</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#putDoubleArray-long-double:A-int-int-">putDoubleArray</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#putFloat-long-float-">putFloat</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#putFloatArray-long-float:A-int-int-">putFloatArray</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#putInt-long-int-">putInt</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#putIntArray-long-int:A-int-int-">putIntArray</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#putLong-long-long-">putLong</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#putLongArray-long-long:A-int-int-">putLongArray</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#putShort-long-short-">putShort</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#putShortArray-long-short:A-int-int-">putShortArray</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#requiresFree--">requiresFree</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#setBits-long-byte-">setBits</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#setMemoryRequest-com.yahoo.memory.MemoryRequest-">setMemoryRequest</a>, <a href="../../../com/yahoo/memory/NativeMemory.html#toHexString-java.lang.String-long-int-">toHexString</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="AllocMemory-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>AllocMemory</h4>
<pre>public&nbsp;AllocMemory(long&nbsp;capacityBytes)</pre>
<div class="block">Constructor for allocate native memory.
<p>Allocates and provides access to capacityBytes directly in native (off-heap) memory
leveraging the Memory interface. The MemoryRequest callback is set to null.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>capacityBytes</code> - the size in bytes of the native memory</dd>
</dl>
</li>
</ul>
<a name="AllocMemory-long-com.yahoo.memory.MemoryRequest-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>AllocMemory</h4>
<pre>public&nbsp;AllocMemory(long&nbsp;capacityBytes,
<a href="../../../com/yahoo/memory/MemoryRequest.html" title="interface in com.yahoo.memory">MemoryRequest</a>&nbsp;memReq)</pre>
<div class="block">Constructor for allocate native memory with MemoryRequest.
<p>Allocates and provides access to capacityBytes directly in native (off-heap) memory leveraging
the Memory interface.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>capacityBytes</code> - the size in bytes of the native memory</dd>
<dd><code>memReq</code> - The MemoryRequest callback</dd>
</dl>
</li>
</ul>
<a name="AllocMemory-com.yahoo.memory.NativeMemory-long-com.yahoo.memory.MemoryRequest-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>AllocMemory</h4>
<pre>public&nbsp;AllocMemory(<a href="../../../com/yahoo/memory/NativeMemory.html" title="class in com.yahoo.memory">NativeMemory</a>&nbsp;origMem,
long&nbsp;newCapacityBytes,
<a href="../../../com/yahoo/memory/MemoryRequest.html" title="interface in com.yahoo.memory">MemoryRequest</a>&nbsp;memReq)</pre>
<div class="block">Constructor for reallocate native memory.
<p>Reallocates the given off-heap NativeMemory to a new a new native (off-heap) memory
location and copies the contents of the original given NativeMemory to the new location.
Any memory beyond the capacity of the original given NativeMemory will be uninitialized.
Dispose of this new memory by calling <a href="../../../com/yahoo/memory/NativeMemory.html#freeMemory--"><code>NativeMemory.freeMemory()</code></a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>origMem</code> - The original NativeMemory that needs to be reallocated and must not be null.
The OS is free to just expand the capacity of the current allocation at the same native
address, or reassign a completely different native address in which case the origMem will be
freed by the OS.
The origMem capacity will be set to zero and must not be used again.</dd>
<dd><code>newCapacityBytes</code> - the desired new capacity of the newly allocated memory in bytes</dd>
<dd><code>memReq</code> - The MemoryRequest callback, which may be null.</dd>
</dl>
</li>
</ul>
<a name="AllocMemory-com.yahoo.memory.NativeMemory-long-long-com.yahoo.memory.MemoryRequest-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>AllocMemory</h4>
<pre>public&nbsp;AllocMemory(<a href="../../../com/yahoo/memory/NativeMemory.html" title="class in com.yahoo.memory">NativeMemory</a>&nbsp;origMem,
long&nbsp;copyToBytes,
long&nbsp;capacityBytes,
<a href="../../../com/yahoo/memory/MemoryRequest.html" title="interface in com.yahoo.memory">MemoryRequest</a>&nbsp;memReq)</pre>
<div class="block">Constructor for allocate native memory, copy and clear.
<p>Allocate a new native (off-heap) memory with capacityBytes; copy the contents of origMem
from zero to copyToBytes; clear the new memory from copyToBytes to capacityBytes.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>origMem</code> - The original NativeMemory, a portion of which will be copied to the
newly allocated Memory.
The reference must not be null.
This origMem is not modified in any way, may be reused and must be freed appropriately.</dd>
<dd><code>copyToBytes</code> - the upper limit of the region to be copied from origMem to the newly
allocated memory.</dd>
<dd><code>capacityBytes</code> - the desired new capacity of the newly allocated memory in bytes and the
upper limit of the region to be cleared.</dd>
<dd><code>memReq</code> - The MemoryRequest callback, which may be null.</dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="freeMemory--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>freeMemory</h4>
<pre>public&nbsp;void&nbsp;freeMemory()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../com/yahoo/memory/NativeMemory.html#freeMemory--">NativeMemory</a></code></span></div>
<div class="block">This frees this Memory only if it is required. This always sets the capacity to zero
and the reference to MemoryRequest to null, which effectively disables this instance.
<p>It is always safe to call this method when you are done with this class.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../com/yahoo/memory/MemoryMappedFile.html#freeMemory--">freeMemory</a></code>&nbsp;in class&nbsp;<code><a href="../../../com/yahoo/memory/MemoryMappedFile.html" title="class in com.yahoo.memory">MemoryMappedFile</a></code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../com/yahoo/memory/package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/AllocMemory.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev&nbsp;Class</li>
<li><a href="../../../com/yahoo/memory/Memory.html" title="interface in com.yahoo.memory"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?com/yahoo/memory/AllocMemory.html" target="_top">Frames</a></li>
<li><a href="AllocMemory.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.com.yahoo.memory.NativeMemory">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2015&#x2013;2017 <a href="https://www.yahoo.com">Yahoo! Inc.</a>. All rights reserved.</small></p>
</body>
</html>