[zeromq-dev] zmq memory useage issue
Michel Pelletier
pelletier.michel at gmail.com
Tue Feb 4 15:57:54 CET 2014
It's not a bug. Redhat 6 comes with a new version of glibc that does
per-thread memory arena allocation. Each thread's pre-allocated heap is
aligned to 64MB.
-Michel
On Mon, Feb 3, 2014 at 6:24 AM, jin.wu <jin.wu at 139.com> wrote:
> Hi, all
>
> I meet a big issue when use zmq at RHEL 6.4, 64bits, it occupies too may
> virtual memory, zeromq version is 3.2.4,
> hope someone can help me analyze, following is my test code.
> At RHEL5.6, 64bits(2.6.18-238.el5) VSZ=36532 ,RSS=1352, but at
> RHEL6.4(2.6.32-358.el6.x86_64) VSZ=104468 RSS=1540
> by using pmap, I find a 65M block virtual memory that hasn't at RHEL5.6,
> it appeared when bind socket in zmq.
> Who ever meet this issue?
>
> Address Kbytes RSS Dirty Mode Mapping
> 0000000000400000 4 4 0 r-x-- mqtest
> 0000000000600000 4 4 4 rw--- mqtest
> 0000000000e42000 132 12 12 rw--- [ anon ]
> 000000392a000000 128 108 0 r-x-- ld-2.12.so
> 000000392a21f000 4 4 4 r---- ld-2.12.so
> 000000392a220000 4 4 4 rw--- ld-2.12.so
> 000000392a221000 4 4 4 rw--- [ anon ]
> 000000392a800000 1576 412 0 r-x-- libc-2.12.so
> 000000392a98a000 2044 0 0 ----- libc-2.12.so
> 000000392ab89000 16 16 8 r---- libc-2.12.so
> 000000392ab8d000 4 4 4 rw--- libc-2.12.so
> 000000392ab8e000 20 16 16 rw--- [ anon ]
> 000000392ac00000 92 60 0 r-x-- libpthread-2.12.so
> 000000392ac17000 2048 0 0 ----- libpthread-2.12.so
> 000000392ae17000 4 4 4 r---- libpthread-2.12.so
> 000000392ae18000 4 4 4 rw--- libpthread-2.12.so
> 000000392ae19000 16 4 4 rw--- [ anon ]
> 000000392b400000 524 20 0 r-x-- libm-2.12.so
> 000000392b483000 2044 0 0 ----- libm-2.12.so
> 000000392b682000 4 4 4 r---- libm-2.12.so
> 000000392b683000 4 4 4 rw--- libm-2.12.so
> 000000392b800000 28 20 0 r-x-- librt-2.12.so
> 000000392b807000 2044 0 0 ----- librt-2.12.so
> 000000392ba06000 4 4 4 r---- librt-2.12.so
> 000000392ba07000 4 4 4 rw--- librt-2.12.so
> 000000392ec00000 88 16 0 r-x--
> libgcc_s-4.4.7-20120601.so.1
> 000000392ec16000 2044 0 0 -----
> libgcc_s-4.4.7-20120601.so.1
> 000000392ee15000 4 4 4 rw---
> libgcc_s-4.4.7-20120601.so.1
> 0000003c37800000 928 468 0 r-x-- libstdc++.so.6.0.13
> 0000003c378e8000 2048 0 0 ----- libstdc++.so.6.0.13
> 0000003c37ae8000 28 28 28 r---- libstdc++.so.6.0.13
> 0000003c37aef000 8 8 8 rw--- libstdc++.so.6.0.13
> 0000003c37af1000 84 12 12 rw--- [ anon ]
> 00007ff834000000 132 4 4 rw--- [ anon ]
> 00007ff834021000 65404 0 0 ----- [ anon ]
> 00007ff8395b6000 4 0 0 ----- [ anon ]
> 00007ff8395b7000 10240 12 12 rw--- [ anon ]
> 00007ff839fb7000 4 0 0 ----- [ anon ]
> 00007ff839fb8000 10268 40 40 rw--- [ anon ]
> 00007ff83a9ca000 264 188 0 r-x-- libzmq.so.3
> 00007ff83aa0c000 2044 0 0 ----- libzmq.so.3
> 00007ff83ac0b000 20 20 20 rw--- libzmq.so.3
> 00007ff83ac10000 4 4 4 rw--- [ anon ]
> 00007fff2e3e8000 84 16 16 rw--- [ stack ]
> 00007fff2e3ff000 4 4 0 r-x-- [ anon ]
> ffffffffff600000 4 0 0 r-x-- [ anon ]
> ---------------- ------ ------ ------
> #include "zmq.h"
> #define QUEUE_HWM 5000
> #define DEFAULT_PUB_ADDR "tcp://127.0.0.1:6666"
> static void *mq_context;
> static void *publisher;
> static int init_publisher();
> int init_publisher()
> {
> mq_context = zmq_ctx_new();
> zmq_ctx_set(mq_context,ZMQ_MAX_SOCKETS, 3);
> publisher = zmq_socket(mq_context, ZMQ_PUB);
> if (NULL == publisher)
> {
> return -1;
> }
> int ret = zmq_bind(publisher, DEFAULT_PUB_ADDR);
> if (ret != 0)
> {
> zmq_close(publisher);
> return -1;
> }
> int out_queue = 5 * QUEUE_HWM;
> zmq_setsockopt(publisher, ZMQ_SNDHWM, &out_queue, sizeof(out_queue));
> return 0;
> }
> int main()
> {
> if (-1 == init_publisher())
> return -1;
> while(1)
> {
> sleep(5);
> }
> return 0;
> }
>
>
>
> Thanks,
> jwu
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140204/5ba67cd1/attachment.htm>
More information about the zeromq-dev
mailing list