kernel/src/mem/SlabAllocator.h
/**
         * Releases a previously allocated object.
         *
         * Should the slab containing the object be completely empty, we'll de-allocate it.
         */
Releases a previously allocated object.
Should the slab containing the object be completely empty, we'll de-allocate it.
Releases a previously allocated object . Should the slab containing the object be completely empty we ' ll de - allocate it .
void free(T *ptr) {
            auto slab = this->head;
            while(slab) {
                if(slab->contains(ptr)) {
                    return slab->free(ptr);
                }
            }
            panic("slab alloc %p failed to find object %p", this, ptr);
        }
void free ( T * ptr ) { auto slab = this -> head ; while ( slab ) { if ( slab -> contains ( ptr ) ) { return slab -> free ( ptr ) ; } } panic ( " " , this , ptr ) ; }
Releases a previously allocated object.
Releases a previously allocated object .
// iterate over all slabs to find which one this belongs to // if we get here, no slab contained the object