 Object destruction is prompt in deterministic memory management, such as in C++ (stack-allocated objects are destroyed on stack unwind, heap-allocated objects are destroyed manually via calling codice_28 or automatically using codice_29) or in deterministic reference-counting (where objects are destroyed immediately when their reference count falls to 0), and thus RAII works well in these situations.However, most modern automatic memory management is non-deterministic, making no guarantees that objects will be destroyed promptly or even at all!This is because it is cheaper to leave some garbage allocated than to precisely collect each object immediately on its becoming garbage.