File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -254,6 +254,9 @@ function tensoralloc(
254254 offset = buffer. offset + allocation_size (T, structure)
255255 buffer. max_offset = max (buffer. max_offset, offset)
256256
257+ # grow buffer if empty
258+ isempty (buffer) && sizehint! (buffer, buffer. max_offset)
259+
257260 # Use pointer if there is enough space
258261 if offset < length (buffer)
259262 buffer. offset = offset
@@ -271,10 +274,5 @@ function allocator_reset!(buffer::BufferAllocator, checkpoint)
271274 checkpoint ≤ buffer. offset ||
272275 throw (ArgumentError (" Invalid checkpoint: `allocator_reset!` has to be called in reverse order on saved checkpoints" ))
273276 buffer. offset = checkpoint
274-
275- # check for growth
276- iszero (checkpoint) && (buffer. max_offset > length (buffer)) &&
277- sizehint! (buffer, buffer. max_offset)
278-
279277 return buffer
280278end
You can’t perform that action at this time.
0 commit comments