Warning

This document hasn't been checked for compatibility with current versions of Plone. Use at your own risk.

I get memory errors running Plone on NetBSD, why?

Zope likes lots of RAM, your server may have lots, but NetBSD limits it to 128MB by default. Memory errors? Here's how to fix it

« Back to Table of Contents

NetBSD (3.1, i386 in this case)  limits process memory, and the limit is pretty tight.  by default, it's 128MB.  Your zope process, if it's anything like mine, will soon eat that up and you'll start to see memory errors and your site visitors will complain.

You can check how much memory your zope process is using with ps or top, have a look at the sysctl limits for it, by feeding sysctl the following arguments:

# sysctl proc.<zope PID>.rlimit

The ones I think you're most interested in are (in my experience)

datasize.soft
memoryuse.soft
There's a number of ways to change a processes limits, you can do it with sysctl on the fly (you can only change soft limits)

eg :

sysctl -w proc.<PID>.rlimit.datasize.soft=<new number of bytes>

which will get you out of gaol without a restart of zope, but isn't, of course, persistant.

You can also set the limit for the zope process at start-time.  Unfortunatly, it seems the best place to do this is in your zopectl or runzope script.  If you have a plone/zope startup script in rc.d, it might not work as you expect.  I did this to my zopectl script to give my instance of zope & plone 356MB:

#! /bin/sh
# let zope use 356MB
ulimit -d 393216
PYTHON=...
etc

I didn't want to do it there, but that seems the safest - yes, you'll have to maintain this script now, but you probably had to anyway if you've been upgrading zope regularly anyway.