On Oct 15, 2010, at 12:43 PM, David Wolfe wrote:

> Hi, all--
> 
> Can anyone offer advice on how to reduce zeromq's memory usage for an
> embedded app?  I think zmq_init() uses the default stack size (8192 KB
> in Linux), which is a pretty big chunk when you've only got 64MB to work
> with(!)  Does zeromq provide an API for controlling this, or is it
> better handled through OS mechanisms?

I don't know what embedded OS you are using (you don't clearly say it is Linux 
based), but the "ulimit" command can be used to modify the default stack size 
from a shell prior to launching your application. I don't know how to do that 
programmatically, but I'm sure it can be done. Perhaps someone better versed in 
UNIX development can chime in with the right system calls to accomplish that 
task.


> Also, for tcp, the buffers corresponding to SO_SNDBUF and SO_RCVBUF are
> probably defaulting to their maximums (128K each, I think).  For my app,
> each client has two sockets, so that could mean 2 * 2 * 128K, or half a
> meg per client.  This could probably be decreased by an order of
> magnitude for my app, so... same question: can this be controlled via
> the API, or are there system calls I should make to do this?

Take a look at the man page for setsockopt(). There are accessors for both send 
and receive buffers that you can use to tune the sizes.

cr
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to