MCPcopy Create free account
hub / github.com/ml-explore/mlx / recycle_to_cache

Method recycle_to_cache

mlx/backend/common/buffer_cache.h:48–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 }
47
48 void recycle_to_cache(T* buf) {
49 assert(buf);
50 // Add to cache.
51 BufferHolder* bh = new BufferHolder(buf);
52 add_at_head(bh);
53 size_t size = get_size_(buf);
54 pool_size_ += size;
55 buffer_pool_.emplace(size, bh);
56 }
57
58 int release_cached_buffers(size_t min_bytes_to_free) {
59 if (min_bytes_to_free >= 0.9 * pool_size_) {

Callers 2

freeMethod · 0.80
freeMethod · 0.80

Calls 1

emplaceMethod · 0.45

Tested by

no test coverage detected