OK so for anyone interested here’s how I solved this problem.
It actually has nothing to do with the RAM, well it does but in a
ripple effect sorta way. Apparently if you have a large number of
pages (not posts) in WP and you have a custom permalink structure such
as %category%/%postname%/ which most people do due to (apparent) SEO
benefits then it basically just turns to shit. You have to use one of
the default link structures that rely on numeric characters if you
have more than approx 40 or 50 pages. The problem though is I could
not get to the permalink menu due to the actual problem I was having so I got around it by changing it directly in phpMyAdmin.
So basically it is a bug in the rewrite.php file located in wp-
includes. If anyone else has this issue the first thing I
would ask them is if they have more than say 40 -50 pages (not posts)
as well as a custom permalink structure. If so, change back to one of the default permalink structures and you should be fine. If you cant get into your permalinks page then you need to go to your database, table labeleld wp_options and change the field labelled”permalink_structure” to “/%year%/%monthnum%/%postname%/”.
Then you will be able to access your permalinks page in the WP Admin and
change it to any of the defualt permalink settings you want.
Cheers.