Skip to content

Commit 6ff32e5

Browse files
author
Documenter.jl
committed
build based on d166c90
1 parent a0dcc3d commit 6ff32e5

File tree

8 files changed

+18
-13
lines changed

8 files changed

+18
-13
lines changed

dev/.documenter-siteinfo.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"documenter":{"julia_version":"1.10.0-rc3","generation_timestamp":"2023-12-20T16:13:06","documenter_version":"1.2.1"}}
1+
{"documenter":{"julia_version":"1.10.0","generation_timestamp":"2024-01-31T13:55:44","documenter_version":"1.2.1"}}

dev/api/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
foo (generic function with 1 method)
77

88
julia> allocs = check_allocs(foo, (Int, Int))
9-
AllocCheck.AllocationSite[]</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaLang/AllocCheck.jl/blob/14e44fcb590fb39e2f0af24f761707b0f494a541/src/AllocCheck.jl#L169-L198">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="AllocCheck.@check_allocs" href="#AllocCheck.@check_allocs"><code>AllocCheck.@check_allocs</code></a><span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@check_allocs ignore_throw=true (function def)</code></pre><p>Wraps the provided function definition so that all calls to it will be automatically checked for allocations.</p><p>If the check fails, an <code>AllocCheckFailure</code> exception is thrown containing the detailed failures, including the backtrace for each defect.</p><p>Note: All calls to the wrapped function are effectively a dynamic dispatch, which means they are type-unstable and may allocate memory at function <em>entry</em>. <code>@check_allocs</code> only guarantees the absence of allocations after the function has started running.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl hljs">julia&gt; @check_allocs multiply(x,y) = x*y
9+
AllocCheck.AllocationSite[]</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaLang/AllocCheck.jl/blob/d166c90bcf0ec1bd62aaebb28be64241a3d9d805/src/AllocCheck.jl#L169-L198">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="AllocCheck.@check_allocs" href="#AllocCheck.@check_allocs"><code>AllocCheck.@check_allocs</code></a><span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@check_allocs ignore_throw=true (function def)</code></pre><p>Wraps the provided function definition so that all calls to it will be automatically checked for allocations.</p><p>If the check fails, an <code>AllocCheckFailure</code> exception is thrown containing the detailed failures, including the backtrace for each defect.</p><p>Note: All calls to the wrapped function are effectively a dynamic dispatch, which means they are type-unstable and may allocate memory at function <em>entry</em>. <code>@check_allocs</code> only guarantees the absence of allocations after the function has started running.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl hljs">julia&gt; @check_allocs multiply(x,y) = x*y
1010
multiply (generic function with 1 method)
1111

1212
julia&gt; multiply(1.5, 3.5) # no allocations for Float64
@@ -21,4 +21,4 @@
2121
[2] multiply(x::Matrix{Float64}, y::Matrix{Float64})
2222
@ Main ./REPL[2]:133
2323
[3] top-level scope
24-
@ REPL[5]:1</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaLang/AllocCheck.jl/blob/14e44fcb590fb39e2f0af24f761707b0f494a541/src/macro.jl#L24-L56">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../tutorials/error_recovery/">« Minimum latency error recovery</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Wednesday 20 December 2023 16:13">Wednesday 20 December 2023</span>. Using Julia version 1.10.0-rc3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
24+
@ REPL[5]:1</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaLang/AllocCheck.jl/blob/d166c90bcf0ec1bd62aaebb28be64241a3d9d805/src/macro.jl#L24-L56">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../tutorials/error_recovery/">« Minimum latency error recovery</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Wednesday 31 January 2024 13:55">Wednesday 31 January 2024</span>. Using Julia version 1.10.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>

dev/assets/documenter.js

+8-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/assets/themes/documenter-dark.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
[3] <span class="sgr1">similar</span>
1515
<span class="sgr90"> @</span> <span class="sgr90">./<span class="sgr4">array.jl:420</span> [inlined]</span>
1616
[4] <span class="sgr1">\</span>
17-
<span class="sgr90"> @</span> <span class="sgr90">/opt/hostedtoolcache/julia/1.10.0-rc3/x64/share/julia/stdlib/v1.10/LinearAlgebra/src/<span class="sgr4">triangular.jl:1483</span> [inlined]</span>
17+
<span class="sgr90"> @</span> <span class="sgr90">/opt/hostedtoolcache/julia/1.10.0/x64/share/julia/stdlib/v1.10/LinearAlgebra/src/<span class="sgr4">triangular.jl:1483</span> [inlined]</span>
1818
[5] <span class="sgr1">\(</span><span class="sgr90">A</span>::Matrix<span class="sgr90">{Float64}</span>, <span class="sgr90">B</span>::Vector<span class="sgr90">{Float64}</span><span class="sgr1">)</span>
19-
<span class="sgr90"> @</span> <span class="sgr35">LinearAlgebra</span> <span class="sgr90">/opt/hostedtoolcache/julia/1.10.0-rc3/x64/share/julia/stdlib/v1.10/LinearAlgebra/src/<span class="sgr4">generic.jl:1118</span></span>
19+
<span class="sgr90"> @</span> <span class="sgr35">LinearAlgebra</span> <span class="sgr90">/opt/hostedtoolcache/julia/1.10.0/x64/share/julia/stdlib/v1.10/LinearAlgebra/src/<span class="sgr4">generic.jl:1118</span></span>
2020
[6] <span class="sgr1">var&quot;##linsolve#228&quot;(</span><span class="sgr90">a</span>::Matrix<span class="sgr90">{Float64}</span>, <span class="sgr90">b</span>::Vector<span class="sgr90">{Float64}</span><span class="sgr1">)</span>
2121
<span class="sgr90"> @</span> <span class="sgr36">Main</span> <span class="sgr90">./<span class="sgr4">REPL[1]:1</span></span>
2222
</code></pre><p>we see what type of object was allocated, and where in the code the allocation appeared.</p><h3 id="Functions-that-throw-exceptions"><a class="docs-heading-anchor" href="#Functions-that-throw-exceptions">Functions that throw exceptions</a><a id="Functions-that-throw-exceptions-1"></a><a class="docs-heading-anchor-permalink" href="#Functions-that-throw-exceptions" title="Permalink"></a></h3><p>Some functions that we do not expect may allocate memory, like <code>sin</code>, actually may:</p><pre><code class="language-julia hljs">@allocated try sin(Inf) catch end</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">48</code></pre><p>The reason for this is that <code>sin</code> needs to allocate if it <strong>throws an error</strong>.</p><p>By default, <code>@check_allocs</code> ignores all such allocations and assumes that no exceptions are thrown. If you care about detecting these allocations anyway, you can use <code>ignore_throw=false</code>:</p><pre><code class="language-julia hljs">@check_allocs mysin1(x) = sin(x)
2323
@check_allocs ignore_throw=false mysin2(x) = sin(x)
2424

2525
@test mysin1(1.5) == sin(1.5)
2626
@test_throws AllocCheckFailure mysin2(1.5)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi"><span class="sgr32"><span class="sgr1">Test Passed</span></span>
27-
Thrown: AllocCheckFailure</code></pre><h2 id="Limitations"><a class="docs-heading-anchor" href="#Limitations">Limitations</a><a id="Limitations-1"></a><a class="docs-heading-anchor-permalink" href="#Limitations" title="Permalink"></a></h2><p>Every call into a <code>@check_allocs</code> function behaves like a dynamic dispatch. This means that it can trigger compilation dynamically (involving lots of allocation), and even when the function has already been compiled, a small amount of allocation is still expected on function entry.</p><p>For most applications, the solution is to use <code>@check_allocs</code> to wrap your top-level entry point or your main application loop, in which case those applications are only incurred once. <code>@check_allocs</code> will guarantee that no dynamic compilation or allocation occurs once your function has started running.</p></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="tutorials/optional_debugging_and_logging/">Optional debugging and logging »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Wednesday 20 December 2023 16:13">Wednesday 20 December 2023</span>. Using Julia version 1.10.0-rc3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
27+
Thrown: AllocCheckFailure</code></pre><h2 id="Limitations"><a class="docs-heading-anchor" href="#Limitations">Limitations</a><a id="Limitations-1"></a><a class="docs-heading-anchor-permalink" href="#Limitations" title="Permalink"></a></h2><p>Every call into a <code>@check_allocs</code> function behaves like a dynamic dispatch. This means that it can trigger compilation dynamically (involving lots of allocation), and even when the function has already been compiled, a small amount of allocation is still expected on function entry.</p><p>For most applications, the solution is to use <code>@check_allocs</code> to wrap your top-level entry point or your main application loop, in which case those applications are only incurred once. <code>@check_allocs</code> will guarantee that no dynamic compilation or allocation occurs once your function has started running.</p></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="tutorials/optional_debugging_and_logging/">Optional debugging and logging »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Wednesday 31 January 2024 13:55">Wednesday 31 January 2024</span>. Using Julia version 1.10.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>

dev/tutorials/error_recovery/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
allocs = check_allocs(treading_lightly, ()) # Check that it&#39;s safe to proceed</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">Any[]</code></pre><pre><code class="language-julia hljs">@test isempty(allocs)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi"><span class="sgr32"><span class="sgr1">Test Passed</span></span></code></pre><p><a href="../../api/#AllocCheck.check_allocs"><code>check_allocs</code></a> returned zero allocations. If we invoke <a href="../../api/#AllocCheck.check_allocs"><code>check_allocs</code></a> with the flag <code>ignore_throw = false</code>, we will see that the function may allocate memory on the error path:</p><pre><code class="language-julia hljs">allocs = check_allocs(treading_lightly, (); ignore_throw = false)
2020
length(allocs)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">6</code></pre><p>Finally, we test that the function is producing the expected result:</p><pre><code class="language-julia hljs">val = treading_lightly()</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi"><span class="sgr32"><span class="sgr1">Test Passed</span></span></code></pre><p>In this example, we accepted an allocation on the exception path with the motivation that it occurred once only, after which the program was terminated. Implicit in this approach is an assumption that the exception path does not allocate too much memory to execute the error recovery logic before the garbage collector is turned back on. We should thus convince ourselves that this assumption is valid, e.g., by means of testing:</p><pre><code class="language-julia hljs">treading_lightly() # Warm start
2121
allocated_memory = @allocated treading_lightly() # A call that triggers the exception path
22-
# @test allocated_memory &lt; 1e4</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">205440</code></pre><p>The allocations sites reported with the flag <code>ignore_throw = false</code> may be used as a guide as to what to test.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../hot_loop/">« Hot loops</a><a class="docs-footer-nextpage" href="../../api/">API »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Wednesday 20 December 2023 16:13">Wednesday 20 December 2023</span>. Using Julia version 1.10.0-rc3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
22+
# @test allocated_memory &lt; 1e4</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">205440</code></pre><p>The allocations sites reported with the flag <code>ignore_throw = false</code> may be used as a guide as to what to test.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../hot_loop/">« Hot loops</a><a class="docs-footer-nextpage" href="../../api/">API »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Wednesday 31 January 2024 13:55">Wednesday 31 January 2024</span>. Using Julia version 1.10.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>

0 commit comments

Comments
 (0)