When someone mention the memory management the c++ is capable of doing, how can i see this thing? is this done in theory like guessing?
i took a logical design intro course and it covered the systems of numbers and boolean algebra and combinational logic,will this help?
so say in Visual Studio , is there some kind of a tool to visualize the memory,i hope im not being ridiculous here ?
thank you.
C++ has a variety of memory areas:
newornew[](C++’s preferred approach) ormalloc(a lower-level function inherited from C), and released withdelete,delete[]orfreerespectively.The heap is important in that it supports run-time requests for arbitrary amounts of memory, and the usage persists until
deleteorfreeis explicitly used, rather than being tied to the lifetime of particular function calls as per stack memory.I’m not aware of any useful tools for visualising and categorising the overall memory usage of a running C++ program, less still for relating that back to which pointers in the source code currently have how much memory associated with them. As a very general guideline, it’s encouraged to write code in such a way that pointers are only introduced when the program is ready to point them at something, and they go out of scope when they will no longer pointer at something. When that’s impractical, it can be useful to set them to
NULL(0), so that if you’re monitoring the executing program in a debugger you can tell the pointer isn’t meant to point to legitimate data at that point.