I'm trying to build a cache package for golang that relies on mmap to store large amounts of content in memory, even more than the system has. The cache doesn't need to be persistant; every time the app run, it loads the cache from redis.
But, what happens when the program crosses the max limit of physical memory? The next allocations happen from disk? If the kernel reclaims the memory from mamp, what happens with the content? It goes away? Do I need to fsync the mmap to disk to prevent this kinds of thing? Or does the kernel automatically do this?