Bug 1555 - valgrind error in time code
valgrind error in time code
Product: ns-3
Classification: Unclassified
Component: core
PC Linux
: P5 blocker
Assigned To: Mathieu Lacage
Depends on: 954
  Show dependency treegraph
Reported: 2012-12-13 14:40 EST by Tom Henderson
Modified: 2012-12-17 00:50 EST (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Tom Henderson 2012-12-13 14:40:52 EST
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"


using namespace ns3;

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 @@

+// dummy object to make sure Time::FreezeResolution is called at least once
+class _dummy
+  ~_dummy () { Time::FreezeResolution();}
+static _dummy dummy;
 } // namespace ns3
Comment 1 Mitch Watrous 2012-12-13 16:10:43 EST
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.
Comment 2 Mathieu Lacage 2012-12-14 07:30:34 EST
+1 for merging if it is not done already
Comment 3 Tom Henderson 2012-12-14 17:55:33 EST
No need to merge; current patch to 954 will be reverted.

I'll close this once the 954 patch is reverted.
Comment 4 Tom Henderson 2012-12-17 00:50:59 EST
fixed with revert of bug 954 patch