2024-10-15 23:12:17 +08:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" lang = "en-US" >
< head >
< meta http-equiv = "Content-Type" content = "text/xhtml;charset=UTF-8" / >
< meta http-equiv = "X-UA-Compatible" content = "IE=11" / >
2025-02-07 04:16:29 +08:00
< meta name = "generator" content = "Doxygen 1.13.2" / >
2024-10-15 23:12:17 +08:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< title > MLX: mlx/allocator.h Source File< / title >
< link href = "tabs.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "jquery.js" > < / script >
< script type = "text/javascript" src = "dynsections.js" > < / script >
< script type = "text/javascript" src = "clipboard.js" > < / script >
< link href = "navtree.css" rel = "stylesheet" type = "text/css" / >
2025-01-10 05:56:20 +08:00
< script type = "text/javascript" src = "navtreedata.js" > < / script >
< script type = "text/javascript" src = "navtree.js" > < / script >
2024-10-15 23:12:17 +08:00
< script type = "text/javascript" src = "resize.js" > < / script >
< script type = "text/javascript" src = "cookie.js" > < / script >
< link href = "search/search.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "search/searchdata.js" > < / script >
< script type = "text/javascript" src = "search/search.js" > < / script >
2025-01-10 05:56:20 +08:00
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
$(function() { init_search(); });
/* @license-end */
< / script >
2024-10-15 23:12:17 +08:00
< link href = "doxygen.css" rel = "stylesheet" type = "text/css" / >
< / head >
< body >
< div id = "top" > <!-- do not remove this div, it is closed by doxygen! -->
< div id = "titlearea" >
< table cellspacing = "0" cellpadding = "0" >
< tbody >
< tr id = "projectrow" >
< td id = "projectalign" >
< div id = "projectname" > MLX
< / div >
< / td >
2025-01-10 05:56:20 +08:00
< td > < div id = "MSearchBox" class = "MSearchBoxInactive" >
< span class = "left" >
< span id = "MSearchSelect" onmouseover = "return searchBox.OnSearchSelectShow()" onmouseout = "return searchBox.OnSearchSelectHide()" >   < / span >
< input type = "text" id = "MSearchField" value = "" placeholder = "Search" accesskey = "S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
< / span > < span class = "right" >
< a id = "MSearchClose" href = "javascript:searchBox.CloseResultsWindow()" > < img id = "MSearchCloseImg" border = "0" src = "search/close.svg" alt = "" / > < / a >
< / span >
< / div >
< / td >
2024-10-15 23:12:17 +08:00
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
2025-02-07 04:16:29 +08:00
<!-- Generated by Doxygen 1.13.2 -->
2024-10-15 23:12:17 +08:00
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
< / script >
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
< / script >
2025-01-10 05:56:20 +08:00
< / div > <!-- top -->
< div id = "side-nav" class = "ui-resizable side-nav-resizable" >
< div id = "nav-tree" >
< div id = "nav-tree-contents" >
< div id = "nav-sync" class = "sync" > < / div >
< / div >
< / div >
< div id = "splitbar" style = "-moz-user-select:none;"
class="ui-resizable-handle">
< / div >
< / div >
2024-10-15 23:12:17 +08:00
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
2025-01-10 05:56:20 +08:00
$(function(){initNavTree('allocator_8h_source.html',''); initResizable(true); });
2024-10-15 23:12:17 +08:00
/* @license-end */
< / script >
2025-01-10 05:56:20 +08:00
< div id = "doc-content" >
2024-10-15 23:12:17 +08:00
<!-- window showing the filter options -->
< div id = "MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
< / div >
<!-- iframe showing the search results (closed by default) -->
< div id = "MSearchResultsWindow" >
< div id = "MSearchResults" >
< div class = "SRPage" >
< div id = "SRIndex" >
< div id = "SRResults" > < / div >
< div class = "SRStatus" id = "Loading" > Loading...< / div >
< div class = "SRStatus" id = "Searching" > Searching...< / div >
< div class = "SRStatus" id = "NoMatches" > No Matches< / div >
< / div >
< / div >
< / div >
< / div >
< div class = "header" >
< div class = "headertitle" > < div class = "title" > allocator.h< / div > < / div >
< / div > <!-- header -->
< div class = "contents" >
< a href = "allocator_8h.html" > Go to the documentation of this file.< / a > < div class = "fragment" > < div class = "line" > < a id = "l00001" name = "l00001" > < / a > < span class = "lineno" > 1< / span > < span class = "comment" > // Copyright © 2023 Apple Inc.< / span > < / div >
< div class = "line" > < a id = "l00002" name = "l00002" > < / a > < span class = "lineno" > 2< / span > < / div >
< div class = "line" > < a id = "l00003" name = "l00003" > < / a > < span class = "lineno" > 3< / span > < span class = "preprocessor" > #pragma once< / span > < / div >
< div class = "line" > < a id = "l00004" name = "l00004" > < / a > < span class = "lineno" > 4< / span > < / div >
< div class = "line" > < a id = "l00005" name = "l00005" > < / a > < span class = "lineno" > 5< / span > < span class = "preprocessor" > #include < cstdlib> < / span > < / div >
< div class = "line" > < a id = "l00006" name = "l00006" > < / a > < span class = "lineno" > 6< / span > < / div >
< div class = "foldopen" id = "foldopen00007" data-start = "{" data-end = "}" >
< div class = "line" > < a id = "l00007" name = "l00007" > < / a > < span class = "lineno" > < a class = "line" href = "namespacemlx.html" > 7< / a > < / span > < span class = "keyword" > namespace < / span > < a class = "code hl_namespace" href = "namespacemlx_1_1core_1_1allocator.html" > mlx::core::allocator< / a > {< / div >
< div class = "line" > < a id = "l00008" name = "l00008" > < / a > < span class = "lineno" > 8< / span > < / div >
< div class = "line" > < a id = "l00009" name = "l00009" > < / a > < span class = "lineno" > 9< / span > < span class = "comment" > // Simple wrapper around buffer pointers< / span > < / div >
< div class = "line" > < a id = "l00010" name = "l00010" > < / a > < span class = "lineno" > 10< / span > < span class = "comment" > // WARNING: Only Buffer objects constructed from and those that wrap< / span > < / div >
< div class = "line" > < a id = "l00011" name = "l00011" > < / a > < span class = "lineno" > 11< / span > < span class = "comment" > // raw pointers from mlx::allocator are supported.< / span > < / div >
< div class = "foldopen" id = "foldopen00012" data-start = "{" data-end = "};" >
2025-01-10 05:56:20 +08:00
< div class = "line" > < a id = "l00012" name = "l00012" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html" > 12< / a > < / span > < span class = "keyword" > class < / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html#ac4fc2cc6aa1368cfb74aff329d9a1300" > Buffer< / a > {< / div >
2024-10-15 23:12:17 +08:00
< div class = "line" > < a id = "l00013" name = "l00013" > < / a > < span class = "lineno" > 13< / span > < span class = "keyword" > private< / span > :< / div >
< div class = "line" > < a id = "l00014" name = "l00014" > < / a > < span class = "lineno" > 14< / span > < span class = "keywordtype" > void< / span > * ptr_;< / div >
< div class = "line" > < a id = "l00015" name = "l00015" > < / a > < span class = "lineno" > 15< / span > < / div >
< div class = "line" > < a id = "l00016" name = "l00016" > < / a > < span class = "lineno" > 16< / span > < span class = "keyword" > public< / span > :< / div >
< div class = "line" > < a id = "l00017" name = "l00017" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html#ac4fc2cc6aa1368cfb74aff329d9a1300" > 17< / a > < / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html#ac4fc2cc6aa1368cfb74aff329d9a1300" > Buffer< / a > (< span class = "keywordtype" > void< / span > * < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html#a990643feac06961c5599aac098c17b94" > ptr< / a > ) : ptr_(< a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html#a990643feac06961c5599aac098c17b94" > ptr< / a > ) {};< / div >
< div class = "line" > < a id = "l00018" name = "l00018" > < / a > < span class = "lineno" > 18< / span > < / div >
< div class = "line" > < a id = "l00019" name = "l00019" > < / a > < span class = "lineno" > 19< / span > < span class = "comment" > // Get the raw data pointer from the buffer< / span > < / div >
< div class = "line" > < a id = "l00020" name = "l00020" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html#a2dfe63e0b4bffeb965cdc50ad4228dbc" > 20< / a > < / span > < span class = "keywordtype" > void< / span > * < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html#a2dfe63e0b4bffeb965cdc50ad4228dbc" > raw_ptr< / a > ();< / div >
< div class = "line" > < a id = "l00021" name = "l00021" > < / a > < span class = "lineno" > 21< / span > < / div >
< div class = "line" > < a id = "l00022" name = "l00022" > < / a > < span class = "lineno" > 22< / span > < span class = "comment" > // Get the buffer pointer from the buffer< / span > < / div >
< div class = "foldopen" id = "foldopen00023" data-start = "{" data-end = "}" >
< div class = "line" > < a id = "l00023" name = "l00023" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html#a990643feac06961c5599aac098c17b94" > 23< / a > < / span > < span class = "keyword" > const< / span > < span class = "keywordtype" > void< / span > * < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html#a990643feac06961c5599aac098c17b94" > ptr< / a > ()< span class = "keyword" > const < / span > {< / div >
< div class = "line" > < a id = "l00024" name = "l00024" > < / a > < span class = "lineno" > 24< / span > < span class = "keywordflow" > return< / span > ptr_;< / div >
< div class = "line" > < a id = "l00025" name = "l00025" > < / a > < span class = "lineno" > 25< / span > };< / div >
< / div >
< div class = "foldopen" id = "foldopen00026" data-start = "{" data-end = "}" >
< div class = "line" > < a id = "l00026" name = "l00026" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html#acb15b2f057568828ea09635ed968b62a" > 26< / a > < / span > < span class = "keywordtype" > void< / span > * < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html#acb15b2f057568828ea09635ed968b62a" > ptr< / a > () {< / div >
< div class = "line" > < a id = "l00027" name = "l00027" > < / a > < span class = "lineno" > 27< / span > < span class = "keywordflow" > return< / span > ptr_;< / div >
< div class = "line" > < a id = "l00028" name = "l00028" > < / a > < span class = "lineno" > 28< / span > };< / div >
< / div >
< div class = "line" > < a id = "l00029" name = "l00029" > < / a > < span class = "lineno" > 29< / span > };< / div >
< / div >
< div class = "line" > < a id = "l00030" name = "l00030" > < / a > < span class = "lineno" > 30< / span > < / div >
< div class = "line" > < a id = "l00031" name = "l00031" > < / a > < span class = "lineno" > < a class = "line" href = "namespacemlx_1_1core_1_1allocator.html#a560d10a166e3c294f3757166f9bd6801" > 31< / a > < / span > < a class = "code hl_class" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html" > Buffer< / a > < a class = "code hl_function" href = "namespacemlx_1_1core_1_1allocator.html#a560d10a166e3c294f3757166f9bd6801" > malloc< / a > (< span class = "keywordtype" > size_t< / span > size);< / div >
< div class = "line" > < a id = "l00032" name = "l00032" > < / a > < span class = "lineno" > 32< / span > < / div >
< div class = "line" > < a id = "l00033" name = "l00033" > < / a > < span class = "lineno" > < a class = "line" href = "namespacemlx_1_1core_1_1allocator.html#a77f0a1215be242db6485612bcb273af5" > 33< / a > < / span > < span class = "keywordtype" > void< / span > < a class = "code hl_function" href = "namespacemlx_1_1core_1_1allocator.html#a77f0a1215be242db6485612bcb273af5" > free< / a > (< a class = "code hl_class" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html" > Buffer< / a > buffer);< / div >
< div class = "line" > < a id = "l00034" name = "l00034" > < / a > < span class = "lineno" > 34< / span > < / div >
< div class = "line" > < a id = "l00035" name = "l00035" > < / a > < span class = "lineno" > 35< / span > < span class = "comment" > // Wait for running tasks to finish and free up memory< / span > < / div >
< div class = "line" > < a id = "l00036" name = "l00036" > < / a > < span class = "lineno" > 36< / span > < span class = "comment" > // if allocation fails< / span > < / div >
< div class = "line" > < a id = "l00037" name = "l00037" > < / a > < span class = "lineno" > < a class = "line" href = "namespacemlx_1_1core_1_1allocator.html#a86ac0a11ff78f21e717f641716c34abc" > 37< / a > < / span > < a class = "code hl_class" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html" > Buffer< / a > < a class = "code hl_function" href = "namespacemlx_1_1core_1_1allocator.html#a86ac0a11ff78f21e717f641716c34abc" > malloc_or_wait< / a > (< span class = "keywordtype" > size_t< / span > size);< / div >
< div class = "line" > < a id = "l00038" name = "l00038" > < / a > < span class = "lineno" > 38< / span > < / div >
< div class = "foldopen" id = "foldopen00039" data-start = "{" data-end = "};" >
2025-01-10 05:56:20 +08:00
< div class = "line" > < a id = "l00039" name = "l00039" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html" > 39< / a > < / span > < span class = "keyword" > class < / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a5803678a418fef687fc65fa9d5c37b65" > Allocator< / a > {< / div >
2024-10-15 23:12:17 +08:00
< div class = "line" > < a id = "l00041" name = "l00041" > < / a > < span class = "lineno" > 41< / span > < span class = "keyword" > public< / span > :< / div >
< div class = "line" > < a id = "l00042" name = "l00042" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a9a17d2c7a97772bf4a15e6c74af34ca4" > 42< / a > < / span > < span class = "keyword" > virtual< / span > < a class = "code hl_class" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html" > Buffer< / a > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a9a17d2c7a97772bf4a15e6c74af34ca4" > malloc< / a > (< span class = "keywordtype" > size_t< / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a2adf9a9c968f113dde830cc0dc27dcc6" > size< / a > , < span class = "keywordtype" > bool< / span > allow_swap = < span class = "keyword" > false< / span > ) = 0;< / div >
< div class = "line" > < a id = "l00043" name = "l00043" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#ae963d551be646ae0e13df2c16f2beefb" > 43< / a > < / span > < span class = "keyword" > virtual< / span > < span class = "keywordtype" > void< / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#ae963d551be646ae0e13df2c16f2beefb" > free< / a > (< a class = "code hl_class" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html" > Buffer< / a > buffer) = 0;< / div >
< div class = "line" > < a id = "l00044" name = "l00044" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a2adf9a9c968f113dde830cc0dc27dcc6" > 44< / a > < / span > < span class = "keyword" > virtual< / span > < span class = "keywordtype" > size_t< / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a2adf9a9c968f113dde830cc0dc27dcc6" > size< / a > (< a class = "code hl_class" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html" > Buffer< / a > buffer) < span class = "keyword" > const< / span > = 0;< / div >
< div class = "line" > < a id = "l00045" name = "l00045" > < / a > < span class = "lineno" > 45< / span > < / div >
< div class = "line" > < a id = "l00046" name = "l00046" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a5803678a418fef687fc65fa9d5c37b65" > 46< / a > < / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a5803678a418fef687fc65fa9d5c37b65" > Allocator< / a > () = < span class = "keywordflow" > default< / span > ;< / div >
2025-01-10 05:56:20 +08:00
< div class = "line" > < a id = "l00047" name = "l00047" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#aa05c081ce80dc036f9d3dd8c195259d2" > 47< / a > < / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#aa05c081ce80dc036f9d3dd8c195259d2" > Allocator< / a > (< span class = "keyword" > const< / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a5803678a418fef687fc65fa9d5c37b65" > Allocator< / a > & other) = < span class = "keyword" > delete< / span > ;< / div >
< div class = "line" > < a id = "l00048" name = "l00048" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a8e8ce346a16cf0c62847bed9289f9959" > 48< / a > < / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a8e8ce346a16cf0c62847bed9289f9959" > Allocator< / a > (< a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a5803678a418fef687fc65fa9d5c37b65" > Allocator< / a > & & other) = < span class = "keyword" > delete< / span > ;< / div >
< div class = "line" > < a id = "l00049" name = "l00049" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a027b84cddc8d476f736ac1f1a9991fe4" > 49< / a > < / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a5803678a418fef687fc65fa9d5c37b65" > Allocator< / a > & < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a027b84cddc8d476f736ac1f1a9991fe4" > operator=< / a > (< span class = "keyword" > const< / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a5803678a418fef687fc65fa9d5c37b65" > Allocator< / a > & other) = < span class = "keyword" > delete< / span > ;< / div >
< div class = "line" > < a id = "l00050" name = "l00050" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a2e971b47339b1d0849a334a902a9df3c" > 50< / a > < / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a5803678a418fef687fc65fa9d5c37b65" > Allocator< / a > & < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a2e971b47339b1d0849a334a902a9df3c" > operator=< / a > (< a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a5803678a418fef687fc65fa9d5c37b65" > Allocator< / a > & & other) = < span class = "keyword" > delete< / span > ;< / div >
2024-10-15 23:12:17 +08:00
< div class = "line" > < a id = "l00051" name = "l00051" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a90ad02c2e2a6ed89bb8bbf7b871efdf1" > 51< / a > < / span > < span class = "keyword" > virtual< / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a90ad02c2e2a6ed89bb8bbf7b871efdf1" > ~Allocator< / a > () = < span class = "keywordflow" > default< / span > ;< / div >
< div class = "line" > < a id = "l00052" name = "l00052" > < / a > < span class = "lineno" > 52< / span > };< / div >
< / div >
< div class = "line" > < a id = "l00053" name = "l00053" > < / a > < span class = "lineno" > 53< / span > < / div >
< div class = "line" > < a id = "l00054" name = "l00054" > < / a > < span class = "lineno" > < a class = "line" href = "namespacemlx_1_1core_1_1allocator.html#aa23e2f20a336d0b159c097087194634e" > 54< / a > < / span > < a class = "code hl_class" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html" > Allocator< / a > & < a class = "code hl_function" href = "namespacemlx_1_1core_1_1allocator.html#aa23e2f20a336d0b159c097087194634e" > allocator< / a > ();< / div >
< div class = "line" > < a id = "l00055" name = "l00055" > < / a > < span class = "lineno" > 55< / span > < / div >
< div class = "foldopen" id = "foldopen00056" data-start = "{" data-end = "};" >
2025-01-10 05:56:20 +08:00
< div class = "line" > < a id = "l00056" name = "l00056" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_common_allocator.html" > 56< / a > < / span > < span class = "keyword" > class < / span > CommonAllocator : < span class = "keyword" > public< / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a5803678a418fef687fc65fa9d5c37b65" > Allocator< / a > {< / div >
2024-10-15 23:12:17 +08:00
< div class = "line" > < a id = "l00058" name = "l00058" > < / a > < span class = "lineno" > 58< / span > < span class = "keyword" > public< / span > :< / div >
< div class = "line" > < a id = "l00059" name = "l00059" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_common_allocator.html#a4f3d5de6b8c0eba22e9403b28a5ef3f0" > 59< / a > < / span > < span class = "keyword" > virtual< / span > < a class = "code hl_class" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html" > Buffer< / a > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_common_allocator.html#a4f3d5de6b8c0eba22e9403b28a5ef3f0" > malloc< / a > (< span class = "keywordtype" > size_t< / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_common_allocator.html#aafa92e8310db089b1ac72b840777e26b" > size< / a > , < span class = "keywordtype" > bool< / span > allow_swap = < span class = "keyword" > false< / span > ) < span class = "keyword" > override< / span > ;< / div >
< div class = "line" > < a id = "l00060" name = "l00060" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_common_allocator.html#a84b50d1a3cbffa12c1a6cf0ed8c71079" > 60< / a > < / span > < span class = "keyword" > virtual< / span > < span class = "keywordtype" > void< / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_common_allocator.html#a84b50d1a3cbffa12c1a6cf0ed8c71079" > free< / a > (< a class = "code hl_class" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html" > Buffer< / a > buffer) < span class = "keyword" > override< / span > ;< / div >
< div class = "line" > < a id = "l00061" name = "l00061" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_common_allocator.html#aafa92e8310db089b1ac72b840777e26b" > 61< / a > < / span > < span class = "keyword" > virtual< / span > < span class = "keywordtype" > size_t< / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_common_allocator.html#aafa92e8310db089b1ac72b840777e26b" > size< / a > (< a class = "code hl_class" href = "classmlx_1_1core_1_1allocator_1_1_buffer.html" > Buffer< / a > buffer) < span class = "keyword" > const override< / span > ;< / div >
< div class = "line" > < a id = "l00062" name = "l00062" > < / a > < span class = "lineno" > 62< / span > < / div >
< div class = "line" > < a id = "l00063" name = "l00063" > < / a > < span class = "lineno" > 63< / span > < span class = "keyword" > private< / span > :< / div >
2025-01-10 05:56:20 +08:00
< div class = "line" > < a id = "l00064" name = "l00064" > < / a > < span class = "lineno" > 64< / span > CommonAllocator() = < span class = "keywordflow" > default< / span > ;< / div >
< div class = "line" > < a id = "l00065" name = "l00065" > < / a > < span class = "lineno" > < a class = "line" href = "classmlx_1_1core_1_1allocator_1_1_common_allocator.html#abf84c726a37df68345589b897b2e35f0" > 65< / a > < / span > < span class = "keyword" > friend< / span > < a class = "code hl_function" href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a5803678a418fef687fc65fa9d5c37b65" > Allocator< / a > & < a class = "code hl_friend" href = "classmlx_1_1core_1_1allocator_1_1_common_allocator.html#abf84c726a37df68345589b897b2e35f0" > allocator< / a > ();< / div >
2024-10-15 23:12:17 +08:00
< div class = "line" > < a id = "l00066" name = "l00066" > < / a > < span class = "lineno" > 66< / span > };< / div >
< / div >
< div class = "line" > < a id = "l00067" name = "l00067" > < / a > < span class = "lineno" > 67< / span > < / div >
< div class = "line" > < a id = "l00068" name = "l00068" > < / a > < span class = "lineno" > 68< / span > } < span class = "comment" > // namespace mlx::core::allocator< / span > < / div >
< / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_allocator_html" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_allocator.html" > mlx::core::allocator::Allocator< / a > < / div > < div class = "ttdef" > < b > Definition< / b > allocator.h:39< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_allocator_html_a027b84cddc8d476f736ac1f1a9991fe4" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a027b84cddc8d476f736ac1f1a9991fe4" > mlx::core::allocator::Allocator::operator=< / a > < / div > < div class = "ttdeci" > Allocator & operator=(const Allocator & other)=delete< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_allocator_html_a2adf9a9c968f113dde830cc0dc27dcc6" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a2adf9a9c968f113dde830cc0dc27dcc6" > mlx::core::allocator::Allocator::size< / a > < / div > < div class = "ttdeci" > virtual size_t size(Buffer buffer) const =0< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_allocator_html_a2e971b47339b1d0849a334a902a9df3c" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a2e971b47339b1d0849a334a902a9df3c" > mlx::core::allocator::Allocator::operator=< / a > < / div > < div class = "ttdeci" > Allocator & operator=(Allocator & & other)=delete< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_allocator_html_a5803678a418fef687fc65fa9d5c37b65" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a5803678a418fef687fc65fa9d5c37b65" > mlx::core::allocator::Allocator::Allocator< / a > < / div > < div class = "ttdeci" > Allocator()=default< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_allocator_html_a8e8ce346a16cf0c62847bed9289f9959" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a8e8ce346a16cf0c62847bed9289f9959" > mlx::core::allocator::Allocator::Allocator< / a > < / div > < div class = "ttdeci" > Allocator(Allocator & & other)=delete< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_allocator_html_a90ad02c2e2a6ed89bb8bbf7b871efdf1" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a90ad02c2e2a6ed89bb8bbf7b871efdf1" > mlx::core::allocator::Allocator::~Allocator< / a > < / div > < div class = "ttdeci" > virtual ~Allocator()=default< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_allocator_html_a9a17d2c7a97772bf4a15e6c74af34ca4" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#a9a17d2c7a97772bf4a15e6c74af34ca4" > mlx::core::allocator::Allocator::malloc< / a > < / div > < div class = "ttdeci" > virtual Buffer malloc(size_t size, bool allow_swap=false)=0< / div > < div class = "ttdoc" > Abstract base class for a memory allocator.< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_allocator_html_aa05c081ce80dc036f9d3dd8c195259d2" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#aa05c081ce80dc036f9d3dd8c195259d2" > mlx::core::allocator::Allocator::Allocator< / a > < / div > < div class = "ttdeci" > Allocator(const Allocator & other)=delete< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_allocator_html_ae963d551be646ae0e13df2c16f2beefb" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_allocator.html#ae963d551be646ae0e13df2c16f2beefb" > mlx::core::allocator::Allocator::free< / a > < / div > < div class = "ttdeci" > virtual void free(Buffer buffer)=0< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_buffer_html" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_buffer.html" > mlx::core::allocator::Buffer< / a > < / div > < div class = "ttdef" > < b > Definition< / b > allocator.h:12< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_buffer_html_a2dfe63e0b4bffeb965cdc50ad4228dbc" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_buffer.html#a2dfe63e0b4bffeb965cdc50ad4228dbc" > mlx::core::allocator::Buffer::raw_ptr< / a > < / div > < div class = "ttdeci" > void * raw_ptr()< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_buffer_html_a990643feac06961c5599aac098c17b94" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_buffer.html#a990643feac06961c5599aac098c17b94" > mlx::core::allocator::Buffer::ptr< / a > < / div > < div class = "ttdeci" > const void * ptr() const< / div > < div class = "ttdef" > < b > Definition< / b > allocator.h:23< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_buffer_html_ac4fc2cc6aa1368cfb74aff329d9a1300" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_buffer.html#ac4fc2cc6aa1368cfb74aff329d9a1300" > mlx::core::allocator::Buffer::Buffer< / a > < / div > < div class = "ttdeci" > Buffer(void *ptr)< / div > < div class = "ttdef" > < b > Definition< / b > allocator.h:17< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_buffer_html_acb15b2f057568828ea09635ed968b62a" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_buffer.html#acb15b2f057568828ea09635ed968b62a" > mlx::core::allocator::Buffer::ptr< / a > < / div > < div class = "ttdeci" > void * ptr()< / div > < div class = "ttdef" > < b > Definition< / b > allocator.h:26< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_common_allocator_html_a4f3d5de6b8c0eba22e9403b28a5ef3f0" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_common_allocator.html#a4f3d5de6b8c0eba22e9403b28a5ef3f0" > mlx::core::allocator::CommonAllocator::malloc< / a > < / div > < div class = "ttdeci" > virtual Buffer malloc(size_t size, bool allow_swap=false) override< / div > < div class = "ttdoc" > A general CPU allocator.< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_common_allocator_html_a84b50d1a3cbffa12c1a6cf0ed8c71079" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_common_allocator.html#a84b50d1a3cbffa12c1a6cf0ed8c71079" > mlx::core::allocator::CommonAllocator::free< / a > < / div > < div class = "ttdeci" > virtual void free(Buffer buffer) override< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_common_allocator_html_aafa92e8310db089b1ac72b840777e26b" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_common_allocator.html#aafa92e8310db089b1ac72b840777e26b" > mlx::core::allocator::CommonAllocator::size< / a > < / div > < div class = "ttdeci" > virtual size_t size(Buffer buffer) const override< / div > < / div >
< div class = "ttc" id = "aclassmlx_1_1core_1_1allocator_1_1_common_allocator_html_abf84c726a37df68345589b897b2e35f0" > < div class = "ttname" > < a href = "classmlx_1_1core_1_1allocator_1_1_common_allocator.html#abf84c726a37df68345589b897b2e35f0" > mlx::core::allocator::CommonAllocator::allocator< / a > < / div > < div class = "ttdeci" > friend Allocator & allocator()< / div > < / div >
< div class = "ttc" id = "anamespacemlx_1_1core_1_1allocator_html" > < div class = "ttname" > < a href = "namespacemlx_1_1core_1_1allocator.html" > mlx::core::allocator< / a > < / div > < div class = "ttdef" > < b > Definition< / b > allocator.h:7< / div > < / div >
< div class = "ttc" id = "anamespacemlx_1_1core_1_1allocator_html_a560d10a166e3c294f3757166f9bd6801" > < div class = "ttname" > < a href = "namespacemlx_1_1core_1_1allocator.html#a560d10a166e3c294f3757166f9bd6801" > mlx::core::allocator::malloc< / a > < / div > < div class = "ttdeci" > Buffer malloc(size_t size)< / div > < / div >
< div class = "ttc" id = "anamespacemlx_1_1core_1_1allocator_html_a77f0a1215be242db6485612bcb273af5" > < div class = "ttname" > < a href = "namespacemlx_1_1core_1_1allocator.html#a77f0a1215be242db6485612bcb273af5" > mlx::core::allocator::free< / a > < / div > < div class = "ttdeci" > void free(Buffer buffer)< / div > < / div >
< div class = "ttc" id = "anamespacemlx_1_1core_1_1allocator_html_a86ac0a11ff78f21e717f641716c34abc" > < div class = "ttname" > < a href = "namespacemlx_1_1core_1_1allocator.html#a86ac0a11ff78f21e717f641716c34abc" > mlx::core::allocator::malloc_or_wait< / a > < / div > < div class = "ttdeci" > Buffer malloc_or_wait(size_t size)< / div > < / div >
< div class = "ttc" id = "anamespacemlx_1_1core_1_1allocator_html_aa23e2f20a336d0b159c097087194634e" > < div class = "ttname" > < a href = "namespacemlx_1_1core_1_1allocator.html#aa23e2f20a336d0b159c097087194634e" > mlx::core::allocator::allocator< / a > < / div > < div class = "ttdeci" > Allocator & allocator()< / div > < / div >
< / div > <!-- fragment --> < / div > <!-- contents -->
< / div > <!-- doc - content -->
2025-01-10 05:56:20 +08:00
<!-- start footer part -->
< div id = "nav-path" class = "navpath" > <!-- id is needed for treeview function! -->
< ul >
< li class = "navelem" > < a class = "el" href = "dir_938ab0ecf10b8b860ff766c820f665fd.html" > mlx< / a > < / li > < li class = "navelem" > < a class = "el" href = "allocator_8h.html" > allocator.h< / a > < / li >
2025-02-07 04:16:29 +08:00
< li class = "footer" > Generated by < a href = "https://www.doxygen.org/index.html" > < img class = "footer" src = "doxygen.svg" width = "104" height = "31" alt = "doxygen" / > < / a > 1.13.2 < / li >
2025-01-10 05:56:20 +08:00
< / ul >
< / div >
2024-10-15 23:12:17 +08:00
< / body >
< / html >