15,911,891 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by creanberries__87 (Top 3 by date)
creanberries__87
26-Oct-15 6:26am
View
I've tried your way, but it didn't resolve the memory leak.
creanberries__87
25-Oct-15 17:59pm
View
Hi,
Firstly, thanks for your time and reply. I've just found the cause of leak. The problem is about that the map is static. The class I mentioned, MyClass is a static class, all members of it are static. And this event, translateInfo is called in lots of places, in another non-static class( MyNonStaticClass ). I am not sure but,I suppose, when I called translateString, it adds std::string type variables, and also references to the class(MyNonStaticClass) which uses MyClass::translateString.
When the object of MyNonStaticClass is destroyed, the reference which is hold by static map, is not released. Could you please share your comments about the exact cause of it ?
creanberries__87
24-Oct-15 10:53am
View
I'2 tried the way you suggested as the following but it didn't worked ;
while( strcmp( s.c_str(), myMap[i] ) != 0 )
// while( s != myMap[i])
By the way, I've examined the output of unit test run. It gives the following error in some places ;
Block size: 28, Address: 0x688d514, Back Trace:
2. Tests(__gnu_cxx::new_allocator<std::_rb_tree_node<std::pair<std::string const,="" std::string=""> > >::allocate(unsigned int, void const*)) [0x806db1e]
3. Tests(std::_Rb_tree<std::string, std::pair<std::string="" const,="" std::string="">, std::_Select1st<std::pair<std::string const,="" std::string=""> >, std::less<std::string>, std::allocator<std::pair<std::string const,="" std::string=""> > >::_M_get_node()) [0x806da43]
4. Tests(std::_Rb_tree<std::string, std::pair<std::string="" const,="" std::string="">, std::_Select1st<std::pair<std::string const,="" std::string=""> >, std::less<std::string>, std::allocator<std::pair<std::string const,="" std::string=""> > >::_M_create_node(std::pair<std::string const,="" std::string=""> const&)) [0x806d96a]
5. Tests(std::_Rb_tree<std::string, std::pair<std::string="" const,="" std::string="">, std::_Select1st<std::pair<std::string const,="" std::string=""> >, std::less<std::string>, std::allocator<std::pair<std::string const,="" std::string=""> > >::_M_insert_(std::_Rb_tree_node_base const*, std::_Rb_tree_node_base const*, std::pair<std::string const,="" std::string=""> const&)) [0x806d67a]
6. Tests(std::_Rb_tree<std::string, std::pair<std::string="" const,="" std::string="">, std::_Select1st<std::pair<std::string const,="" std::string=""> >, std::less<std::string>, std::allocator<std::pair<std::string const,="" std::string=""> > >::_M_insert_unique_(std::_Rb_tree_const_iterator<std::pair<std::string const,="" std::string=""> >, std::pair<std::string const,="" std::string=""> const&)) [0x806d2bc]
7. Tests(std::map<std::string, std::string,="" std::less<std::string="">, std::allocator<std::pair<std::string const,="" std::string=""> > >::insert(std::_Rb_tree_iterator<std::pair<std::string const,="" std::string=""> >, std::pair<std::string const,="" std::string=""> const&)) [0x806cfb2]
8. Tests(std::map<std::string, std::string,="" std::less<std::string="">, std::allocator<std::pair<std::string const,="" std::string=""> > >::operator[](std::string const&)) [0x806ca94]
9. MyClass::translateInput(std::string const&)) [0x430267c]
Do you have any comment about this ?
Thanks in advance,
Cranberries