When you delete a post or a page or a comment, it goes in a Trash instead of being removed permanently. Using the following snippet will ease you job of deletion and will tell WordPress to automatically delete trash itself. Simply copy and paste the following lines of code in your wp-config,php file and you are done.

Note: Make sure that you do replace 1 by X to empty spam comments automatically every X days.