1. A method, performed by a computer system storing a main memory database, for performing memory compaction within the main memory database, the method comprising: scanning a doubly linked list of pages in memory, the pages for storing records of the main memory database, scanning comprising determining memory utilization of each page; determining, based on the memory utilization of each page, which pages have a memory utilization that is below a specified threshold; for each page having a memory utilization below the threshold, performing a memory compaction process, the memory compaction process comprising: identifying each valid record in the page; for each valid record, creating a new version of the valid record in an active page; for each valid record for which a new version is created, marking the valid record as invalid; and after marking each valid record in the page as invalid, the page being emptied and removed from the doubly linked list.