Unless you’re dealing with secrets that would lead to the overthrow of governments, using Disk Utility’s secure erase feature meets the mark. HDDs can also be physically destroyed with a drill equipped with a bit suitable for puncturing the metal casing. A hammer and chisel could work, too. If you have a dead HDD and if you think anyone with motivation might pay to have the data recovered, physical destruction is the only way to ensure data isn’t readable.
Data is written in an unpredictable fashion on SSDs to distribute the wear across all the memory cells in the solid-state device. As a result, a secure erase feature doesn’t work at all, as it may not overwrite all the data. Physical destruction is really the only course of action, which is an unfortunate waste of technology. And if you have a Mac in which the SSD isn’t removable, but part of the computer, that’s even worse.
Fortunately, the various kinds of RAMs used by generations of Macs are all volatile memory: the contents disappear instantly or shortly after a device is powered down. So far, there’s no way to recover any traces of data from RAM chips.