I am playing around with some variant
and any classes
and I try to figure out if there is a faster alternative to boost::spirit::hold_any
or if it's the fastest soloution around. Is there something faster than this?
And maybe a subquestion, Dr Memory says any_hold
is causing memory leaks
, is that true? (I heard some things about that but i thought maybe it were fixed or only a rumor, I'm using Boost 1.57.0)
How reliable is Dr Memory in this case?
I executed mainly code like:
int main()
{
boost::spirit::hold_any a;
for (unsigned int i = 0; 150000 > i; ++i)
{
a = 5;
a = 5.0;
}
return 0;
}
The Logfile of Dr Memory:
Dr. Memory version 1.8.1 build 0 built on Feb 17 2015 19:08:31
Dr. Memory results for pid 6208: "boostTest.exe"
Application cmdline: ""C:\Users\tim.junge\Documents\Visual Studio 2010\Projects\C++\Backup\boostTest\Debug\boostTest.exe""
Recorded 108 suppression(s) from default C:\Users\tim.junge\Documents\Visual Studio 2010\Projects\C++\DrMemory-Windows-1.8.1-RC1\bin\suppress-default.txt
Error #1: LEAK 8 direct bytes 0x00a801d8-0x00a801e0 + 0 indirect bytes
# 0 replace_operator_new [d:\drmemory_package\common\alloc_replace.c:2613]
# 1 boost::spirit::basic_hold_any<>::assign<> [c:\boost_1_57_0\boost\spirit\home\support\detail\hold_any.hpp:293]
# 2 boost::spirit::basic_hold_any<>::operator=<> [c:\boost_1_57_0\boost\spirit\home\support\detail\hold_any.hpp:305]
# 3 main [c:\users\tim.junge\documents\visual studio 2010\projects\c++\backup\boosttest\boosttest\main.cpp:50]
Error #2: LEAK 8 direct bytes 0x00a87810-0x00a87818 + 0 indirect bytes
# 0 replace_operator_new [d:\drmemory_package\common\alloc_replace.c:2613]
# 1 boost::spirit::basic_hold_any<>::assign<> [c:\boost_1_57_0\boost\spirit\home\support\detail\hold_any.hpp:293]
# 2 boost::spirit::basic_hold_any<>::operator=<> [c:\boost_1_57_0\boost\spirit\home\support\detail\hold_any.hpp:305]
# 3 main [c:\users\tim.junge\documents\visual studio 2010\projects\c++\backup\boosttest\boosttest\main.cpp:212]
Reached maximum leak report limit (-report_leak_max). No further leaks will be reported.
===========================================================================
FINAL SUMMARY:
DUPLICATE ERROR COUNTS:
Error # 2: 9992
SUPPRESSIONS USED:
ERRORS FOUND:
0 unique, 0 total unaddressable access(es)
0 unique, 0 total uninitialized access(es)
0 unique, 0 total invalid heap argument(s)
0 unique, 0 total GDI usage error(s)
0 unique, 0 total handle leak(s)
0 unique, 0 total warning(s)
2 unique, 9993 total, 79944 byte(s) of leak(s)
0 unique, 0 total, 0 byte(s) of possible leak(s)
ERRORS IGNORED:
1 potential leak(s) (suspected false positives)
(details: C:\Users\tim.junge\Documents\Visual Studio 2010\Projects\C++\DrMemory-Windows-1.8.1-RC1\drmemory\logs\DrMemory-boostTest.exe.6208.000\potential_errors.txt)
0 unique, 0 total, 0 byte(s) of still-reachable allocation(s)
(re-run with "-show_reachable" for details)
50204 leak(s) beyond -report_leak_max
Details: C:\Users\tim.junge\Documents\Visual Studio 2010\Projects\C++\DrMemory-Windows-1.8.1-RC1\drmemory\logs\DrMemory-boostTest.exe.6208.000\results.txt