You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
print(io, " ($tot_used used, capacity $tot_capacity, all in main buffer)")
30
+
else
31
+
plural =length(b.additional_buffers) ==1?"":"s"
32
+
print(io, " ($tot_used used$main_buffer_used_str, capacity $tot_capacity [$main_buffer_capacity in main buffer] with $(length(b.additional_buffers)) additional buffer$plural)")
- for repeated runs of the same size, a single contiguous buffer will be used, which should approximately match the performance of a tuned `AllocBuffer`
24
51
- `AutoscalingAllocBuffer` can reuse allocated memory between runs like `AllocBuffer`, but with safety from overrunning a fixed buffer size and OOMing like `SlabBuffer`. Additionally, `AutoscalingAllocBuffer` separately tracks the memory used by the main buffer vs the additional buffers allocated dynamically, so small unexpected additional allocations don't double the memory consumption (unlike a second slab being allocated).
25
52
26
-
27
53
!!! note
28
54
The default `initial_buffer_size` and `max_history_size` are subject to change in non-breaking releases of AllocArrays.jl in order to tune performance in common cases. Additionally, the internal heuristics likewise may change.
Copy file name to clipboardExpand all lines: test/autoscaling_alloc_buffer.jl
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,10 @@ using Bumper: alloc!, reset_buffer!
30
30
# still not too many additional buffers
31
31
@testlength(b.additional_buffers) <10
32
32
33
+
@testset"show"begin
34
+
@testsprint(show, b) =="AutoscalingAllocBuffer()"
35
+
@testsprint(show, MIME"text/plain"(), b) =="AutoscalingAllocBuffer() (7.668 MiB used [0.0% in main buffer], capacity 9.690 MiB [0.0% in main buffer] with 7 additional buffers)"
36
+
end
33
37
# now check reset: we should have more capacity than used last time,
34
38
# while having no additional buffers
35
39
used =amount_used(b)
@@ -46,4 +50,10 @@ using Bumper: alloc!, reset_buffer!
46
50
reset_buffer!(b)
47
51
end
48
52
@testtotal_capacity(b) <2n
53
+
54
+
@testset"show"begin
55
+
cap = Base.format_bytes(total_capacity(b))
56
+
@testsprint(show, b) =="AutoscalingAllocBuffer()"
57
+
@testsprint(show, MIME"text/plain"(), b) =="AutoscalingAllocBuffer() (0 bytes used, capacity $cap, all in main buffer)"
0 commit comments