diff --git a/mlx/backend/metal/allocator.cpp b/mlx/backend/metal/allocator.cpp index 51cc3a109..e5deef994 100644 --- a/mlx/backend/metal/allocator.cpp +++ b/mlx/backend/metal/allocator.cpp @@ -81,24 +81,6 @@ void BufferCache::recycle_to_cache(MTL::Buffer* buf) { } } -void BufferCache::release_cached_buffers(size_t min_bytes_to_free) { - if (min_bytes_to_free >= 0.9 * pool_size_) { - clear(); - } else { - std::lock_guard lk(cache_mutex_); - size_t total_bytes_freed = 0; - while (tail_ && (total_bytes_freed < min_bytes_to_free)) { - if (tail_->buf) { - total_bytes_freed += tail_->buf->length(); - tail_->buf->release(); - tail_->buf = nullptr; - } - remove_from_list(tail_); - } - pool_size_ -= total_bytes_freed; - } -} - void BufferCache::add_at_head(BufferCache::BufferHolder* to_add) { if (!to_add) return; diff --git a/mlx/backend/metal/allocator.h b/mlx/backend/metal/allocator.h index 24b66653e..bdb256095 100644 --- a/mlx/backend/metal/allocator.h +++ b/mlx/backend/metal/allocator.h @@ -23,7 +23,6 @@ class BufferCache { MTL::Buffer* reuse_from_cache(size_t size); void recycle_to_cache(MTL::Buffer* buf); - void release_cached_buffers(size_t min_bytes_to_free); private: struct BufferHolder {