Description
Discussion at https://groups.google.com/forum/#!topic/autobahnws/1WkyztKdoLw
I'm looking at using Autobahn-cpp in an embedded arm system with bonefish as the WAMP router.
I built the callee example, but was surprised to see it has a very large memory foot print (a number of processes have been removed from this listing):
Mem: 61968K used, 177892K free, 0K shrd, 748600K buff, 235092K cached
CPU: 1% usr 9% sys 0% nic 88% idle 0% io 0% irq 0% sirq
Load average: 0.19 0.28 0.31 1/126 2641
PID PPID USER STAT VSZ %MEM %CPU COMMAND
2622 1031 root S 54500 23% 0% ./callee -r map300 -p 8888
1025 1024 root S 8104 3% 0% ./bonefish --realm map300 --websocket-port 8080 --rawsocket-port 8888
This so I dug in a bit, and pmap shows 6 "stack" signatures (we have 8K stacks on this box):
2622: ./callee -r map300 -p 8888
00010000 336K r-x-- callee
00073000 4K r---- callee
00074000 4K rw--- callee
00075000 148K rw--- [ anon ]
b3a00000 4K ----- [ anon ]
b3a01000 8188K rw--- [ anon ]
b4200000 4K ----- [ anon ]
b4201000 8188K rw--- [ anon ]
b4a00000 4K ----- [ anon ]
b4a01000 8188K rw--- [ anon ]
b5200000 4K ----- [ anon ]
b5201000 8188K rw--- [ anon ]
b5a00000 4K ----- [ anon ]
b5a01000 8320K rw--- [ anon ]
b6221000 892K ----- [ anon ]
b63a8000 4K ----- [ anon ]
b63a9000 8188K rw--- [ anon ]
b6ba8000 412K r-x-- libm.so.6
b6c0f000 60K ----- libm.so.6
b6c1e000 4K r---- libm.so.6
b6c1f000 4K rw--- libm.so.6
but it only has one thread (from cat /proc/XXXX/status):
VmPMD: 0 kB
VmSwap: 0 kB
Threads: 1
SigQ: 0/1742
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
Historically I've seen this when threads are not disconnected or joined. The stack memory gets orphaned and is not released until the program exits.
I removed the two RPC registrations and the stack count decreases by two. I suspect it is the boost future that is involved with the problem.
Same high number of stacks is seen with publisher and I suspect is common to all the other examples.
Have tried using the cppWamp library (forked from Autobahn) and it doesn't exhibit this problem, but it doesn't use boost futures.