|
Bugzilla – Full Text Bug Listing |
| Summary: | Crash when using NS_LOG in destructors of static objects | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | Peter Barnes <pdbarnes> |
| Component: | core | Assignee: | Mathieu Lacage <mathieu.lacage> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | ns-bugs, tomh |
| Priority: | P5 | ||
| Version: | ns-3-dev | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://www.nsnam.org/bugzilla/show_bug.cgi?id=1496 | ||
| Attachments: |
Patch that leaves new'ed memory undeleted.
Revised patch |
||
|
Description
Peter Barnes
2012-11-15 02:38:56 UTC
At first, I thought that this sounded like a good idea but I reviewed the code and some log.h/cc changes that are recent but which I failed to look at earlier. 1) earlier patches change #ifdef __LOG_H__ to LOG_H. oops. I was about to ask : "what is the likelyhood that someone has a LOG_H macro defined ?". It is sufficiently high that it should be at least NS3_LOG_H instead. (which, I think, is the ns-3-sanctified-style anyway) 2) Are you suggesting that we make the code leak a std::map upon each call to GetLevelLabel ? I might be really just sleepy/soaked to the bones on a rainy monday morning but this sounds like a bad idea (tm). GetLevelLabel can be called by pretty much any logging statement, depending on how you have setup your logging output, right ? 3) Why is GetLevelLabel not coded with a switch/case statement ? a std::map that contains 5 hardcoded items ? Unless there is a serious reason for that, we could trivially change that code to use a set of if/then/else or switch/case statements, close the bug, and get back to business. Patch for bug 1496 introduced the std::map Mathieu is referring to: Commit 9c0cc3997ece http://code.nsnam.org/ns-3-dev/rev/9c0cc3997ece Commit 7353 [09fccf6195ea] changed the include guard. (In reply to comment #1) > 1) earlier patches change #ifdef __LOG_H__ to LOG_H. oops. I was about to Changed to NS3_LOG_H. (We have 740 include guards; only 24 use NS_* NS2_* NS3_* or NSC_*) > 2) Are you suggesting that we make the code leak a std::map upon each call > to GetLevelLabel ? I might be really just sleepy/soaked to the bones on a > rainy monday morning but this sounds like a bad idea (tm). GetLevelLabel can Yes, it is a bad idea (tm). > 3) Why is GetLevelLabel not coded with a switch/case statement ? a std::map Thankyou! This is much nicer. Revised patch attached. Created attachment 1478 [details]
Revised patch
(In reply to comment #5) > Created attachment 1478 [details] > Revised patch It looks like the patch has some other changes to the logic of which levels to log (or maybe it is just code shuffling, I can't tell without reviewing this more carefully) but I trust you have tested this so, it is good for commit on my side. thanks for this quick turnaround time. revised patch pushed in changeset: 065a297f6c9d |