To add to the other answers:
/etc/crontab and in the folder
/etc/cron.d for any cron jobs that run around that time. (See
man cron for how this file works). There are other folders (
cron./monthly/weekly/dailyhourly) that contain jobs that are run at those intervals, but likely only
cron.hourly will have anything that will run at midnight, and that's usually empty on standard Debian configurations.
Another possibility is that the midnight thing is a coincidence, and Debian is running so low on memory that the kernel has invoked the
oom_killer (Link), whereby it tries to keep itself alive by killing processes, based on a scoring system. However, if this were the case, you'd probably have noticed your services not running.
dmesg will log any points at which the oom_killer was invoked since you booted the OS. (
/var/log/kern.log will have older ones)
To be clear, though. There's nothing inherent in Debian (or any Linux) that can clear memory. RAM is either free, where Linux will typically use it as a cache for the filesystem until something requires it, or allocated to a process.