Hello. I understand not especially in Linux, at the level of implementation by manuals. It took to raise your vps server. I found a suitable host on the debian server with a very minimal config: cpu 1 core 0.6 Ghz, 384 RAM. Approximately 30-50 users contact the server every 10 seconds, and quite often in php-log you see this:
PHP Fatal error: Out of memory (allocated 262144) (tried to allocate 261900 bytes) in Unknown on line 0
sometimes I can't even connect via ftp or via putty because there is not enough memory.
And most importantly, I do not understand why there is not enough memory if, when viewed in the 'top', it shows approximately that another 200 meters is free : Mem: 393216k total, 159172k used, 234044k free.
scripts and queries to the database are not particularly loaded, the execution speed is high. googling, chopped off innodb in mysql, and slightly changed the values of ServerLimits.
Here is a screen from the "top", can someone tell me something? Is 40 users really such a strong load? 