+ 1

Heap corrupted error in c++

Hello I am having a considerable complex code written in c++ on visual studio 2015... I am randomly getting heap corruption error and couldn't trace... what I observed is that memory was not released ..so, I put delete[] at proper place for all dynamic memory allocation of char*.... additionally I ensured that char* size is string size plus one (for null character) during new allocation... with these two, i feel problem should be solved.. what is your view on this....? I have extensive singleton classes and it's static member pointer of class type is allocated once with new when it is null... I have not released memory of this new allocation of singleton classes.... hope this is fine nd would not corrupt memory... Feel free to ask in case I am not clear enough..

3rd Mar 2019, 5:09 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
10 Answers
+ 2
Julien Quentin nothing is done to observe it... I have just heard sometime about different third party tool for this but no idea about that... regarding smart pointers, j am not sure whether I could use it or not because char* is argument other third party API is asking for.. can I use the smart pointer....? I have no experience in smart pointer or valgrind
3rd Mar 2019, 5:43 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
is there something so that I can track within visual studio without opting for thrid party tool... if not, what is better option and how can I track issue of heap corruption
4th Mar 2019, 2:33 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
Julien Quentin , all; I have enterprise edition and I hope it would have all tools. would love to explore if someone can throw some light on internal profiling tools of vs... yes, string would be nice to avoid char pointer...
4th Mar 2019, 4:38 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
~ swim ~ no... can't as it's having NDA ...
4th Mar 2019, 4:36 PM
Ketan Lalcheta
Ketan Lalcheta - avatar