In general, if you are using a HD wallet, when you are actually using the wallet, you will need to keep the used addresses (and transaction history) in RAM, which is more expensive than HDD or SDD storage. For most casual users who use bitcoin on a personal basis, this should not be a big deal, however, for heaver users, such as businesses, this can quickly add up. The appropriate solution would be for the business to periodically create new HD wallets and retain copies of their old seed.
I don't see any reason to keep the transaction history in memory since it is not something you need to have ready for access. The addresses don't need to be kept in memory either, if saved in a database it just needs to be accessible. But even if you keep addresses in memory it still shouldn't be that expensive, a million of them could take up to about 300-350 MB of RAM. My running browser takes up more memory than that.
No current wallet software (that I am aware of) that is publically available will keep the list of addresses it needs to watch outside of RAM. I am not sure about how transactions are stored, however, they are readily available enough for me to believe they are also stored in RAM.
A business could implement their own custom HD wallet software, but I don't think they could store the addresses in their wallet outside of RAM. If they did store the addresses outside of RAM, the custom software would need to access every address every time a block is found, which would be inefficient.
Well, if you use a hardware wallet you usually have a watch-only wallet in the software, with the ability to generate addresses on the fly from the xpub, which is permanently stored on disk.
Of course, every time you access something, for the CPU to be able to compute on it, it is temporarily loaded into RAM. But not all addresses (aren't there infinitely many of them?
) have to be kept in RAM at the same time. When the software periodically checks balances, it loads xpub into RAM, generates addresses from that (kept in RAM), checks the balances and then probably writes them to disk as a sort of cache. When it's done, the RAM is flushed.
The addresses are probably even removed from RAM right after being checked, so you might actually only have one address in RAM at a time; meaning no matter how many wallets and transactions you have, memory usage should be minimal.
I know for a fact, that BlueWallet shows me the last few transactions and wallet balances as soon as I open it; then immediately starts to look if there are any changes. But it does show cached values that have been written to disk right away & only starts updating afterwards.