MCPcopy Create free account
hub / github.com/Ipotrick/Daxa / zero_ref_callback

Method zero_ref_callback

src/impl_core.cpp:622–636  ·  view source on GitHub ↗

This is weird. When a mem block is zonbiefied, its cpu memory allocation is already gone. This can cause issues when we want to later use it in destruction of memory block suballocated resources.

Source from the content-addressed store, hash-verified

620// When a mem block is zonbiefied, its cpu memory allocation is already gone.
621// This can cause issues when we want to later use it in destruction of memory block suballocated resources.
622void daxa_ImplMemoryBlock::zero_ref_callback(ImplHandle const * handle)
623{
624 auto const * self = r_cast<daxa_ImplMemoryBlock const*>(handle);
625 std::unique_lock const lock{self->device->zombies_mtx};
626 u64 const submit_timeline_value = self->device->global_submit_timeline.load(std::memory_order::relaxed);
627 self->device->memory_block_zombies.emplace_front(
628 submit_timeline_value,
629 MemoryBlockZombie{
630 .allocation = self->allocation,
631 });
632 self->device->dec_weak_refcnt(
633 daxa_ImplDevice::zero_ref_callback,
634 self->device->instance);
635 delete self;
636}
637
638// --- End daxa_ImplMemoryBlock ---

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected