```{index} single: destroy; Digest::SHA function ``` ```{index} single: Digest::SHA::destroy; Perl function ``` # destroy Release the native context attached to a `Digest::SHA` object. The Perl destructor. Invoked automatically when the last reference to a `Digest::SHA` object goes out of scope — you do not normally call it yourself. It frees the heap-allocated hashing context behind the blessed reference. ## Synopsis ```perl { my $sha = Digest::SHA->new(256); # ... use $sha ... } # DESTROY runs here when $sha leaves scope ``` ## What you get back Nothing. `DESTROY` returns to Perl with no value. ## Examples ```perl my $sha = Digest::SHA->new(256); undef $sha; # triggers DESTROY ``` ```perl ## Double-free safety: explicit DESTROY followed by scope exit is harmless. my $sha = Digest::SHA->new(256); $sha->DESTROY; ## automatic DESTROY on scope exit is a no-op after the explicit call ``` ## Edge cases - Calling `DESTROY` on an object that is not a blessed `Digest::SHA` reference is silently ignored. - After `DESTROY`, the object's internal pointer is zeroed, so repeated calls are safe. ## Differences from upstream Fully compatible with upstream `Digest::SHA` {{ upstream.Digest_SHA }}. ## See also - `new` — counterpart: allocates the context that `DESTROY` releases. - `clone` — each clone also owns a context and is destroyed independently.