Stop and Start the Instance In a Job
You can't expect a service that is not running to execute a command to start itself. You need to use something external. The SQL Agent service is dependent upon the SQL service running, that's why you can't do this in a job inside of SQL Agent. You could use the default windows task scheduler, or you could look to have the SQL service try to restart itself if it is found to be stopped.

That being said, your reason for restarting the service in order to release memory means that you should focus your efforts on proper memory management and not on how to dynamically restart the instance.