Files
blog_os/blog/content/edition-2/posts/10-heap-allocation/call-stack-heap-freed.svg
2020-12-16 14:56:36 +01:00

2 lines
10 KiB
XML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="600px" height="315px" viewBox="-0.5 -0.5 600 315" content="&lt;mxfile modified=&quot;2019-03-20T12:30:37.584Z&quot; host=&quot;www.draw.io&quot; agent=&quot;Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0&quot; version=&quot;10.5.0&quot; etag=&quot;_hKsTU1yJ74yCezLoimt&quot; type=&quot;google&quot;&gt;&lt;diagram id=&quot;MB8OoVxK4yWLwS3R75-q&quot;&gt;7Vpbb+I4FP41SO3DIMfO9bHQmZ2HWalSV9rdp5WbGLDGxGwwBebX73Eu5GIILSSUbstDiY8dH/v7jn3srwzIeL75LaGL2e8yYmKAUbQZkPsBxp5P4K82bDOD4/mZYZrwKDNZpeGR/2K5EeXWFY/YstZQSSkUX9SNoYxjFqqajSaJXNebTaSoe13QKTMMjyEVpvVPHqlZZvWxV9q/Mz6dFZ4tN8hq5rRonM9kOaORXFdM5OuAjBMpVfY034yZ0NgVuGTvfTtQuxtYwmL1khdw9sIzFat8bvm41LaYLIujO40ZlGIZg3E0U3MBJQsewU2y/QsKqCj8rQtDFOxqH1jC50yxJG+VOWCRAXE5ZmuHBEQQk/B2soUm6xJrJ8dvVoG5sCVMUMWf693TnPLprrudhwfJwTFGeXTafjAMKp88NItQLbwUHS7lKglZ3kcV6Ua3xANUCHEcD9lu4AVes9shwq5vOy7xHJ/4dSeKJlOmDCfwUAGoNKUk7yecfBL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&gt;"><defs/><g><path d="M 156 117 L 0.04 117.03" fill="none" stroke="#000000" stroke-width="1.3" stroke-miterlimit="10" pointer-events="none"/><path d="M 156 65 L 0.04 65.03" fill="none" stroke="#000000" stroke-width="1.3" stroke-miterlimit="10" pointer-events="none"/><rect x="0.65" y="39" width="156" height="26" fill="#ffe6cc" stroke="#000000" stroke-width="1.3" pointer-events="none"/><g transform="translate(54.5,41.5)scale(1.3)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="37" height="15" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 38px; white-space: nowrap; overflow-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">x = 1</div></div></foreignObject><text x="19" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">x = 1</text></switch></g><rect x="0.65" y="65" width="156" height="26" fill="#ffe6cc" stroke="#000000" stroke-width="1.3" pointer-events="none"/><g transform="translate(72.5,67.5)scale(1.3)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="8" height="15" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 9px; white-space: nowrap; overflow-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">y</div></div></foreignObject><text x="4" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">y</text></switch></g><rect x="0.65" y="117" width="156" height="26" fill="#ffffff" stroke="#000000" stroke-width="1.3" pointer-events="none"/><path d="M 78.65 155.61 L 78.65 146.51" fill="none" stroke="#000000" stroke-width="1.3" stroke-miterlimit="10" stroke-dasharray="1.3 1.3" pointer-events="none"/><path d="M 156.65 169.26 L 156.65 143.26" fill="none" stroke="#000000" stroke-width="1.3" stroke-miterlimit="10" stroke-dasharray="1.3 1.3" pointer-events="none"/><path d="M 0.65 169.26 L 0.65 143.26" fill="none" stroke="#000000" stroke-width="1.3" stroke-miterlimit="10" stroke-dasharray="1.3 1.3" pointer-events="none"/><path d="M 78 35.36 L 78 26.26" fill="none" stroke="#000000" stroke-width="1.3" stroke-miterlimit="10" stroke-dasharray="1.3 1.3" pointer-events="none"/><path d="M 155.35 39.26 L 155.35 13.26" fill="none" stroke="#000000" stroke-width="1.3" stroke-miterlimit="10" stroke-dasharray="1.3 1.3" pointer-events="none"/><path d="M 0.65 39.26 L 0.65 13.26" fill="none" stroke="#000000" stroke-width="1.3" stroke-miterlimit="10" stroke-dasharray="1.3 1.3" pointer-events="none"/><rect x="195.65" y="26" width="403" height="117" fill="#ffe6cc" stroke="#000000" stroke-width="1.3" pointer-events="none"/><g transform="translate(201.5,30.5)scale(1.3)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="240" height="82" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: monospace; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 241px; white-space: nowrap; overflow-wrap: normal;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><div style="font-size: 14px" align="left"><font style="font-size: 14px">fn outer() {</font></div><div style="font-size: 14px" align="left"><font style="font-size: 14px">  let x = 1;</font></div><div style="font-size: 14px" align="left"><font style="font-size: 14px">  let y =</font> inner(x);</div><div style="font-size: 14px" align="left">  deallocate(y, size_of(u32));<br /></div><div style="font-size: 14px" align="left">}<br /></div></div></div></foreignObject><text x="120" y="47" fill="#000000" text-anchor="middle" font-size="12px" font-family="monospace">[Not supported by viewer]</text></switch></g><rect x="0.65" y="91" width="156" height="26" fill="#ffffff" stroke="#000000" stroke-width="1.3" pointer-events="none"/><path d="M 78.65 298.61 L 78.65 289.51" fill="none" stroke="#000000" stroke-width="1.3" stroke-miterlimit="10" stroke-dasharray="1.3 1.3" pointer-events="none"/><path d="M 156.65 312.26 L 156.65 286.26" fill="none" stroke="#000000" stroke-width="1.3" stroke-miterlimit="10" stroke-dasharray="1.3 1.3" pointer-events="none"/><path d="M 0.65 312.26 L 0.65 286.26" fill="none" stroke="#000000" stroke-width="1.3" stroke-miterlimit="10" stroke-dasharray="1.3 1.3" pointer-events="none"/><g transform="translate(32.5,3.5)scale(1.3)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="71" height="15" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; white-space: nowrap; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Call Stack</div></div></foreignObject><text x="36" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">Call Stack</text></switch></g><g transform="translate(54.5,185.5)scale(1.3)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="37" height="15" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; white-space: nowrap; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Heap</div></div></foreignObject><text x="19" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">Heap</text></switch></g><rect x="0.65" y="234" width="156" height="26" fill="#ffffff" stroke="#000000" stroke-width="1.3" pointer-events="none"/><rect x="0.65" y="260" width="156" height="26" fill="#f8cecc" stroke="#000000" stroke-width="1.3" pointer-events="none"/><g transform="translate(42.5,262.5)scale(1.3)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="55" height="15" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 56px; white-space: nowrap; overflow-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">z[2] = 3</div></div></foreignObject><text x="28" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">z[2] = 3</text></switch></g><rect x="0.65" y="208" width="156" height="26" fill="#f8cecc" stroke="#000000" stroke-width="1.3" pointer-events="none"/><g transform="translate(42.5,210.5)scale(1.3)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="55" height="15" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 56px; white-space: nowrap; overflow-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">z[0] = 1</div></div></foreignObject><text x="28" y="14" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">z[0] = 1</text></switch></g></g></svg>