|
Bugzilla – Full Text Bug Listing |
| Summary: | valgrind error in time code | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | Tom Henderson <tomh> |
| Component: | core | Assignee: | Mathieu Lacage <mathieu.lacage> |
| Status: | RESOLVED FIXED | ||
| Severity: | blocker | CC: | ns-bugs, watrous |
| Priority: | P5 | ||
| Version: | pre-release | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Bug Depends on: | 954 | ||
| Bug Blocks: | |||
This patch did not bug 1554, which has to do with seg faults in the first.py example on ns-regresssion, i.e. it did not make first.py work on that machine. +1 for merging if it is not done already No need to merge; current patch to 954 will be reverted. I'll close this once the 954 patch is reverted. |
Some ns-3 tests and examples do not call Simulator::Run(), and hence Time::FreezeResolution() is not called and the times set is not deleted. To reproduce, run this program under valgrind: #include "ns3/core-module.h" NS_LOG_COMPONENT_DEFINE ("s"); using namespace ns3; int main (int argc, char *argv[]) { return 0; } The below patch can resolve the error: diff -r f094300690db src/core/model/time.cc --- a/src/core/model/time.cc Wed Dec 12 22:43:49 2012 -0800 +++ b/src/core/model/time.cc Thu Dec 13 08:56:14 2012 -0800 @@ -279,5 +279,14 @@ ATTRIBUTE_VALUE_IMPLEMENT (Time); ATTRIBUTE_CHECKER_IMPLEMENT (Time); +// dummy object to make sure Time::FreezeResolution is called at least once +class _dummy +{ +public: + ~_dummy () { Time::FreezeResolution();} +}; + +static _dummy dummy; + } // namespace ns3