static apr_status_t cleanup_slotmem(void *param)
{
    int is_child = is_child_process();
    ap_slotmem_instance_t *next = globallistmem;

    while (next) {
        if (!is_child && AP_SLOTMEM_IS_PERSIST(next)) {
            store_slotmem(next);
        }
        apr_shm_destroy(next->shm);
        apr_shm_remove(next->name, next->gpool);
        next = next->next;
    }

    globallistmem = NULL;
    return APR_SUCCESS;
}