The VM fails to collect the garbage generated during MAM lookups
automatically, so mod_mam_mnesia's memory usage easily goes up to
several gigabytes if we don't force garbage collection.
Don't write MAM messages into an Mnesia archive if the size of the table
comes close to the 2 GB limit for tables with disc-only copies. That
way, the table is at least not corrupted when the limit is reached.
Let mod_mam_mnesia use transactions when storing or deleting messages.
If old messages of a user are to be removed, delete the user's archive
and rewrite it from scratch, as that seems to be much faster than
removing individual records with delete_object/1.
Closes#1065.