Templates blog plugin – Memory Leak (Fatal Memory Error even at 512M)

I have searched through forum and followed all advice I can find.

I keep getting a 500 error, I check log, I get the following

PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 82 bytes) in /mnt/stor3-wc2-dfw1/500755/sssss.com/web/content/wp-includes/wp-db.php on line 1405

As you can see in error its already set at 512M.

My tables in template site are as follows

wp_4_commentmeta, wp_4_comments, wp_4_dynamic_widgets, wp_4_gallery_slides, wp_4_links

wp_4_options, wp_4_postmeta, wp_4_posts, wp_4_proplayer, wp_4_proplayer_playlist

wp_4_terms, wp_4_term_relationships, wp_4_term_taxonomy

Most of the tables have records less than 20 except for options(781), postmeta(487), post(157)

I have only 4 active plugins

If i create without template it works, so the issue seems to be with blog template.

I feel like 512M is a lot of memory for creating a few tables with few records.

I have been battling with this for about a week and my client is getting frustrated, I will appreciate every and any help

here is the setting on server showing memory

http://awesomescreenshot.com/0bdcdvu82