Boost logo

Boost Users :

Subject: [Boost-users] [Signals2] Signal memory overhead
From: Sean Buckheister (s_buckhe_at_[hidden])
Date: 2012-03-20 13:01:08


Hello,

I've been using the Signals2 library for a while now, and I'm very happy
with it. But lately I have noticed that the library seems to have a
rather large overhead in terms of memory consumption. My measurements
indicate 233 bytes per signal<>, and an additional 128 bytes of overhead
per connected slot. Connections themselves are lightweight at 24 bytes,
as expected. I've been measuring on Linux 64bit, by creating a class
with one signal and a number of active connections to that signal. This
class is instantiated on the heap and the pointer is discarded. When run
under Valgrind, I get the numbers mentioned above. All measurements have
been done with threading support disabled (using
boost::signals2::dummy_mutex).

Since I don't need most of the features (my signals have one active
connection most of time, seldomly more), I hacked together a small
replacement that fits my needs as well. That code measures at 32 bytes
per signal, 32 bytes per slot and 16 bytes per connection. Of course it
provides nothing except connect/disconnect and operator().

Am I using the library incorrectly? Does my measurement method skew results?

 -- Sean


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net