Hi,

did you try the latest cxxtools with the pointer to std::deque? This may fix the problem, but I'm not really sure.


Tommi

Am 28.07.2015 um 10:05 schrieb Jean-Marc Choulet:
Hi Tommi,

Your modifications don’t compile on my Mac OS X. The problem is certainly the Mac OS X compiler :

MacBook:~ jm$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
MacBook:~ jm$


Yesterday, I installed GCC 4.9.2 from sources. All works fine now :)

Thanks,

Jean-Marc


Le 25 juil. 2015 à 16:46, Tommi Mäkitalo <[email protected] <mailto:[email protected]>> a écrit :

Hi,

I checked in the change. Now we have a pointer to std::deque in SerializationInfo. I benchmarked the variants of SerializationInfo and indeed the version with std::deque was significantly slower than std::vector and the last change to pointer to deque is about as fast as std::vector. The size of SerializationInfo with std::vector was 96 bytes, with std::deque 160 bytes and with the pointer only 80 bytes. So I feel, that the last implementation is indeed the best.

But using a pointer is quite challenging to get copying and moving right, so that I hope, that there are not memory leaks or other bugs. Please test it. I will also test with valgrind.

Tommi

Am 25.07.2015 um 12:12 schrieb Tommi Mäkitalo:
Hi,

I made a important change in cxxtools::SerializationInfo.

The subnodes were held in a std::vector. We got a crash in our application since addMember might reallocate the vector, which invalidates the references previously got from addMember on that node. So I changed the container into a std::deque, which do not invalidate references.

I partly understand, why gcc on MacOS X has problems with that. The class SerializationInfo has a member of type std::deque<SerializationInfo>. But the compiler do not know the full class when it sees the declaration. I'm quite sure this is fully legal C++. And it was ok with std::vector.

But I have a idea, how to help the compiler.

Instead of holding a std::deque, it may just have a pointer to a std::deque.

There is a drawback but also a advantage. The drawback is, that SerializationInfo has to allocate the deque, which is a additional allocation. The advantage is that the sizeof(SerializationInfo) will be reduces. On my system sizeof(deque) is 80 but the sizeof(pointer) is just 8, so the sizeof(SerializationInfo will be reduced by 72 bytes. I guess that most of the SerializationInfos won't have subnodes. There in normal applications more values than arrays or objects to serialize, so that overall memory consumption will be reduced.

There are many unittests for SerializationInfo and all rpc unittests and others use SerializationInfo also. So the risk to break something is negligible.


Tommi

Am 25.07.2015 um 07:33 schrieb Jean-Marc Choulet:
Hello,

I have installed manually automate, autoconf, …

I can run autoreconf without errors . I have now a error when I try to compile cxxtools :

make
Making all in src

… lines deleted …

In file included from csvdeserializer.cpp:29:
In file included from ../include/cxxtools/csvdeserializer.h:33:
In file included from ../include/cxxtools/deserializer.h:33:
In file included from ../include/cxxtools/composer.h:31:
In file included from ../include/cxxtools/serializationinfo.h:39:
*/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/deque:912:49: **error: **invalid application of 'sizeof' to an* * incomplete type 'value_type' (aka 'cxxtools::SerializationInfo')* static const difference_type __block_size = sizeof(value_type) < 256 ? 4096 / sizeof(value_type) : 16;
*^~~~~~~~~~~~~~~~~~*
*/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/deque:1183:15: note: *in instantiation of template class 'std::__1::__deque_base<cxxtools::SerializationInfo, std::__1::allocator<cxxtools::SerializationInfo> >' requested here
    : private __deque_base<_Tp, _Allocator>
*            ^*
*../include/cxxtools/serializationinfo.h:120:17: note: *in instantiation of template class 'std::__1::deque<cxxtools::SerializationInfo,
std::__1::allocator<cxxtools::SerializationInfo> >' requested here
        typedef Nodes::iterator Iterator;
*              ^*
*../include/cxxtools/serializationinfo.h:110:7: note: *definition of 'cxxtools::SerializationInfo' is not complete until the closing '}'
class SerializationInfo
*    ^*
In file included from csvdeserializer.cpp:29:
In file included from ../include/cxxtools/csvdeserializer.h:33:
In file included from ../include/cxxtools/deserializer.h:33:
In file included from ../include/cxxtools/composer.h:31:
In file included from ../include/cxxtools/serializationinfo.h:39:
*/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/deque:1193:30: **error: **'__alloc_traits' is a protected member* * of 'std::__1::__deque_base<cxxtools::SerializationInfo, std::__1::allocator<cxxtools::SerializationInfo> >'*
    typedef typename __base::__alloc_traits        __alloc_traits;
*                          ^*
*../include/cxxtools/serializationinfo.h:120:17: note: *in instantiation of template class 'std::__1::deque<cxxtools::SerializationInfo,
std::__1::allocator<cxxtools::SerializationInfo> >' requested here
        typedef Nodes::iterator Iterator;
*              ^*
*/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/deque:904:54: note: *declared protected here
    typedef allocator_traits<allocator_type> __alloc_traits;
*  ^*
*… lines deleted ...*
*  ^*
*/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/deque:1359:30: **error: **'__map_const_pointer' is a protected* * member of 'std::__1::__deque_base<cxxtools::SerializationInfo, std::__1::allocator<cxxtools::SerializationInfo> >'*
    typedef typename __base::__map_const_pointer __map_const_pointer;
*                          ^*
*/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/deque:930:81: note: *declared protected here typedef typename allocator_traits<__const_pointer_allocator>::const_pointer __map_const_pointer;
*                              ^*
In file included from csvdeserializer.cpp:29:
In file included from ../include/cxxtools/csvdeserializer.h:33:
In file included from ../include/cxxtools/deserializer.h:33:
In file included from ../include/cxxtools/composer.h:31:
*../include/cxxtools/serializationinfo.h:679:9: **error: **indirection requires pointer operand ('SerializationInfo::ConstIterator' (aka 'int') invalid)*
        *it >>= vec.back();
*      ^~~*
*../include/cxxtools/serializationinfo.h:707:9: **error: **indirection requires pointer operand ('SerializationInfo::ConstIterator' (aka 'int') invalid)*
        *it >>= list.back();
*      ^~~*
*../include/cxxtools/serializationinfo.h:735:9: **error: **indirection requires pointer operand ('SerializationInfo::ConstIterator' (aka 'int') invalid)*
        *it >>= deque.back();
*      ^~~*
*../include/cxxtools/serializationinfo.h:763:9: **error: **indirection requires pointer operand ('SerializationInfo::ConstIterator' (aka 'int') invalid)*
        *it >>= t;
*      ^~~*
*../include/cxxtools/serializationinfo.h:792:9: **error: **indirection requires pointer operand ('SerializationInfo::ConstIterator' (aka 'int') invalid)*
        *it >>= t;
*      ^~~*
*../include/cxxtools/serializationinfo.h:838:9: **error: **indirection requires pointer operand ('SerializationInfo::ConstIterator' (aka 'int') invalid)*
        *it >>= v;
*      ^~~*
*../include/cxxtools/serializationinfo.h:868:9: **error: **indirection requires pointer operand ('SerializationInfo::ConstIterator' (aka 'int') invalid)*
        *it >>= v;
*      ^~~*
*../include/cxxtools/serializationinfo.h:927:9: **error: **indirection requires pointer operand ('SerializationInfo::ConstIterator' (aka 'int') invalid)*
        *it >>= t;
*      ^~~*
*fatal error: **too many errors emitted, stopping now [-ferror-limit=]*
20 errors generated.
make[2]: *** [csvdeserializer.lo] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1
MacBook-Pro-de-Jean-Marc:cxxtools




Is it possible to compile tntnet on Mac OS X ?

Thanks,

Jean-Marc


------------------------------------------------------------------------------


_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general



------------------------------------------------------------------------------


_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

------------------------------------------------------------------------------
_______________________________________________
Tntnet-general mailing list
[email protected] <mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/tntnet-general



------------------------------------------------------------------------------


_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

------------------------------------------------------------------------------
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to