That is called "battery conditioning"
Also (on nicads) sometime VERY briefly hitting them with REVERSE VOLTAGE (in other words, stick them in a circuit with another robust voltage in series and a "0 ohm resistor" will burn through some kind of chemical layer they build up which causes the memory effect. But only do that "shortly" and only do it (check first) with almost dead batteries.
Don't do that with other kinds of rechargeable battery (besides nicads) unless you want to both destroy it and potentially start a fire or worse.