NoMemoryError (failed to allocate memory)

Hi All,
    I am developing a ruby on rails application with mysql and met the
memory error yesterday.
    I just put it online yesterday. It worked fine for the first hour
and suddenly I got "NoMemoryError (failed to allocate memory)" and
mysql crashed after that.
    I use vps for 384M memory, so I think there must something wrong
with my ror application or configuration.
    Can anyone give me some advice to locate the problem or monitor
the application?

Sorry for the disturbing. Can admin help me to delete the duplicated
messages?