Opened 10 years ago
Closed 10 years ago
#3256 closed defect (fixed)
Memory leak in ModelicaSimulationError?
Reported by: | Rüdiger Franke | Owned by: | Rüdiger Franke |
---|---|---|---|
Priority: | critical | Milestone: | 1.9.3 |
Component: | Cpp Run-time | Version: | trunk |
Keywords: | Cc: | Nils Menager, Volker Waurich, Niklas Worschech, Martin Flehmig |
Description
r25329 (re-)commits the code:
class ModelicaSimulationError : public std::runtime_error { public: ModelicaSimulationError(SIMULATION_ERROR error_id, const std::string& error_info) : runtime_error(strdup(error_info.c_str())) , _error_id(error_id) { }
Who frees the memory allocated with strdup
?
Change History (5)
comment:1 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 10 years ago
Cc: | added |
---|
comment:4 by , 10 years ago
Owner: | changed from | to
---|
comment:5 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I think the overloaded what() method was the problem. It created the message in a local variable and returned a pointer to it. r25356 creates the message during construction instead, exploiting its storage in std::runtime_error.
Note:
See TracTickets
for help on using tickets.
I remember I added the strdup because sometimes crashed on throw.
You can try to remove it and see which models fail and why.
The revision in question: r24674.