Skip to content

Commit

Permalink
Appease the typo-bot
Browse files Browse the repository at this point in the history
  • Loading branch information
staticfloat committed Feb 8, 2024
1 parent 2bb044a commit 5435eb9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/independentlylinearizedutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ mutable struct CachePool{T, THREAD_SAFE}
const pool::Vector{T}
const alloc::Function
lock::ReentrantLock
num_alloced::Int
num_allocated::Int
num_acquired::Int

function CachePool(T, alloc::F; thread_safe::Bool = true) where {F}
Expand All @@ -55,7 +55,7 @@ are available.
Base.@inline function acquire!(cache::CachePool{T}, _dummy = nothing) where {T}
cache.num_acquired += 1
if isempty(cache.pool)
cache.num_alloced += 1
cache.num_allocated += 1
return cache.alloc()::T

Check warning on line 59 in src/independentlylinearizedutils.jl

View check run for this annotation

Codecov / codecov/patch

src/independentlylinearizedutils.jl#L55-L59

Added lines #L55 - L59 were not covered by tests
end
return pop!(cache.pool)

Check warning on line 61 in src/independentlylinearizedutils.jl

View check run for this annotation

Codecov / codecov/patch

src/independentlylinearizedutils.jl#L61

Added line #L61 was not covered by tests
Expand Down
2 changes: 1 addition & 1 deletion src/saving.jl
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ cache = LinearizingSavingCallbackCache(prob, solver; num_derivatives)
# Store the results in this array of independently linearized solutions
ilss = Vector{IndependentlyLinearizedSolution}(undef, num_trajectories)
# Create `prob_func` piece ot remake `prob` to have the correct callback,
# Create `prob_func` piece to remake `prob` to have the correct callback,
# hooking up the necessary caching pieces.
function linearizer_adding_remake(prob,i,_)
ilss[i] = IndependentlyLinearizedSolution(prob, num_derivatives; cache_pool=cache.ils_cache)
Expand Down
4 changes: 2 additions & 2 deletions test/independentlylinearizedtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ using DiffEqCallbacks: CachePool, acquire!, release!, @with_cache
@test u₁[1] == 1.0
end

previously_alloced = pool.num_alloced
previously_allocated = pool.num_allocated
# Test that asking for a vector while we have one free does not allocate
function foo(pool)
return @with_cache pool u begin
u[1]
end
end
@test foo(pool) == 1.0
@test pool.num_alloced == previously_alloced
@test pool.num_allocated == previously_allocated
end
end

Expand Down

0 comments on commit 5435eb9

Please sign in to comment.