Hello, After compiling libboost_thread-gcc-mt.so on debian/gcc-2.95.4, this so weights 195kB, while libpthread weights only 100kB. Why such a huge difference ? Isn't boost::thread meant to be as lightweight as possible ? What about the raw inpact on runtime memory consumption compared to std pthreads ?
Amerio wrote:
Hello, After compiling libboost_thread-gcc-mt.so on debian/gcc-2.95.4, this so weights 195kB, while libpthread weights only 100kB. Why such a huge difference ? Isn't boost::thread meant to be as lightweight as possible ?
Try building it with Boost.Build v2 (bjam --v2 gcc release). It's only 64K because read_write_mutex.o (223K in release) is excluded from link. I don't know whether it's intentional or an oversight. -- Alexander Nasonov
Alexander Nasonov wrote:
Amerio wrote:
Hello, After compiling libboost_thread-gcc-mt.so on debian/gcc-2.95.4, this so weights 195kB, while libpthread weights only 100kB. Why such a huge difference ? Isn't boost::thread meant to be as lightweight as possible ?
Try building it with Boost.Build v2 (bjam --v2 gcc release). It's only 64K because read_write_mutex.o (223K in release) is excluded from link. I don't know whether it's intentional or an oversight.
I'm afraid it's an oversight -- that's a recently added feature. I'm surprised that it adds so much to the size though, let me try here. Without read_write_mutex the size of gcc/release/shared build is 46K. With read_write_mutex the size is 136K. Wow, that's a difference! When I comment out explicit template instantiations in that source file, the library is becomes 76K. The comment says explicit instantination are needed to detect syntax errors in templates but those instantination bloat the library. BTW, I'm not sure read_write_mutex should be a template, either. Maybe, we need class polymorphic_mutex; and template<class Mutex> class concrete_polymorphic_mutex : public polymorphic_mutex { }; and read_write_mutex_impl must be implemented in terms of polymorphic_mutex? - Volodya
participants (3)
-
Alexander Nasonov
-
Amerio
-
Vladimir Prus