Skip to content

Commit

Permalink
build based on 5d19026
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Oct 8, 2024
1 parent 3d21f2e commit fd4b568
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion previews/PR82/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-16T20:06:22","documenter_version":"1.7.0"}}
{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-10-08T04:18:36","documenter_version":"1.7.0"}}
4 changes: 2 additions & 2 deletions previews/PR82/api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
foo (generic function with 1 method)

julia> allocs = check_allocs(foo, (Int, Int))
AllocCheck.AllocationSite[]</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaLang/AllocCheck.jl/blob/9df767554fe9c34c722611ce51d5b7fb0740223f/src/AllocCheck.jl#L185-L214">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><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></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
AllocCheck.AllocationSite[]</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaLang/AllocCheck.jl/blob/5d1902658dbc33bf02cf59ab7dcc6a4c003afda2/src/AllocCheck.jl#L185-L214">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><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></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
multiply (generic function with 1 method)

julia&gt; multiply(1.5, 3.5) # no allocations for Float64
Expand All @@ -21,4 +21,4 @@
[2] multiply(x::Matrix{Float64}, y::Matrix{Float64})
@ Main ./REPL[2]:133
[3] top-level scope
@ REPL[5]:1</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaLang/AllocCheck.jl/blob/9df767554fe9c34c722611ce51d5b7fb0740223f/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="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Monday 16 September 2024 20:06">Monday 16 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
@ REPL[5]:1</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaLang/AllocCheck.jl/blob/5d1902658dbc33bf02cf59ab7dcc6a4c003afda2/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="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Tuesday 8 October 2024 04:18">Tuesday 8 October 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
2 changes: 1 addition & 1 deletion previews/PR82/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@

@test mysin1(1.5) == sin(1.5)
@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>
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="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Monday 16 September 2024 20:06">Monday 16 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
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="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Tuesday 8 October 2024 04:18">Tuesday 8 October 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
2 changes: 1 addition & 1 deletion previews/PR82/tutorials/error_recovery/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
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)
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
allocated_memory = @allocated treading_lightly() # A call that triggers the exception path
# @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="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Monday 16 September 2024 20:06">Monday 16 September 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
# @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="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Tuesday 8 October 2024 04:18">Tuesday 8 October 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit fd4b568

Please sign in to comment.