Catalina MacMini shut down on sleep ... panic

I recently upgraded my Mac Mini (late 2014) to Catalina - version 10.15.4
It turns off often when it sleeps. Not every time. Usually at night when I’ve left it for a while but not every night.
“Panic” is mentioned in the fault report.
Any ideas how I might solve this?

Here is an article at MacPaw about kernel panics.

Do you have a Hub connected to the Mac Mini???

If you mean a USB hub yes

I’ve removed the USB hub as the MacPaw article also mentions that as a possible problem. I’ll try that for a few days and see if it does the job. But then does that mean I chuck away the hub? Puts me off upgrading the OS as I can’t see much benefit to me and a lot of hassle!

My MacMini continues to restart when I leave it for a while.
The issue seems to be something to do with the memory filling up. I’ve used CleanMyMac X to optimise memory but I frequently get messages like the attached. I’ve also done Free Memory using Parallels. As well as this I’ve done a clean install of Catalina and only one by one re-added apps and files. I’ve also done an Apple diagnostic but it says everything is good. Does anyone have an idea what I can do to sort out this on-going RAM problem?Screenshot 2020-06-09 09.09.14

Have you restarted?
Have you used CleanMyMac X’s Optimization and Maintenance routines?
Are you running the latest macOS version?
How long is ‘a while’?
Why don’t you put the Mac to sleep?
How much RAM is in your mini?

Use Activity Monitor to see which apps are using RAM. If there are errant processes kill them.

Restarted many times.
Yes done CleanMyMac X opt & maintainability
When I installed Catalina that’s when the problems started
“a while” varies a lot … maybe half an hour or a few hours
8Gb RAM on the mini
Activity monitor … done that.

I’ve given up and reverted to a clean install of Mojave. So far it’s behaving … that’s about 4 days.
Jury is still out.
Thanks for your suggestions