memory debugger for c++ [closed] - c++

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
one of the most part in programming is debug problem and increase performance ( i think! ), and I never did serious debug because I just write small programs.
but this time i write a program that little big, and i doubt there is some problems in memory.
so I want a debugger that do the following:
support c++ .
check if there is leak memory .
calculate the size of memory that my application allocate .
check every function or object separately .
using GUI ( graphical user interface ) .

If you're using Linux try using Valgrind. It does everything you specified.

Check out valgrind and gdb. With those two tools you should be able to do what you want. Having said that they're not GUI's, but that's not a downside.

Microsoft's run time libraries have lots of useful functions to track memory. Only works on Windows though.

On Windows you should check out WinDbg.

Related

How is the process from compiling a c/c++ code to executing it? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm a student of computer science and I have a couple of questions related to the process of compiling a c/c++ code. One question is, when you compile, does it get compiled to assembler or machine code? At the same time, is this assembler/machine code a version for the operating system? The reason of my last question is that when you compile, your program can be executed in different cpus in the same operating system. Apart from that your program can't be executed in another operating system. This make me wonder what there is in the executable you generate for an operating system and what the operating system do with it in order to execute it in different cpu.
Thanks in advance and sorry for so many questions.
I think you may be confused about some basics of the process.
The compilation process is illustrated nicely in section 1.6 here: https://www3.ntu.edu.sg/home/ehchua/programming/cpp/gcc_make.html
Your compiled code will be for a specific operating system and cpu architecture.
Read this: https://softwareengineering.stackexchange.com/questions/251250/why-do-executables-depend-on-the-os-but-not-on-the-cpu

Reduce the size of Flash memory embedded cpp [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
After a lot of research i could not find any solution to my question (if i did i woudln't be here ...)
I'm looking for solutions that permits me to reduce the flash memory used by my program.
I'm programming an embedded c++ programm and when i Flash my electronic card in release mode everything is fine cause it doesn't overflow the space of the flash memory, but that is not the case when i do it in Debug mode... I want to know if it is possible to find functions (my goal is to do it without reducing the code) that could reduce Flash memory.I already thought about defragmentation but I don't find how to do it in embedded even though i don't even know if i can ... I also tried the -Os cmd from gcc but without any big success
So I'm taking any advices or support and i'll be there at any question about my issue ;)
Thanks !
Look at your map file. Is there something there you don't
expect? Functions you aren't expecting (like floating point, or
exception handling, etc.) or something unreasonably large?
Turn on optimization except for the file you're interested in.
Make sure you've actually got optimizations turned on (look at the build log and ensure that you've got -Os being passed to each compile step)
Consider link time optimizations, but don't expect miracles
Welcome to embedded programming. 90% of the job is figuring out how to stuff the never ending requirements into the memory available. Rinse and repeat.

Do i need to learn c before learning c++? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I started to learn C, but I realized that all i could do was to build thse console programs (correct me if i'm wrong). So, i've seen that c++ is much more "graphic", like, you can build apps and windows, and is also OOP, what makes everything easier. So, do I need to finish learning c before c++?
Also, what interested me about C was that I could program an Arduino. Can I program an Arduino with C++?
All the "graphic" things are supported by libraries, no matter in C(e.g. GTK, SDL) or C++ (e.g. QT).
And for hardware drive programming, no matter what language it is. You have to compile it into binaries so that the hardware will knows how to run. You can even create your own language if you can write your own compiler.

Debug a huge memory leak which freezes the computer (C++) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
My application has a huge memory leak which eats all my memory instantly, and I can't debug as it freezes the computer ...
Do you guys have any technical solution for that kind of issue?
Edit : I am using Qt Creator with Windows 7 and MSVC compiler.
Cheers
You cannot just freeze a computer with a single instruction. If you allocate a lot of memory, it will either crash the program or use a virtual memory space without actually consuming the real space.
Thus, if you debug it further, maybe in smaller steps, I am sure you will find your solution.
There are many debugging tools that you can try to use, depending on your working environment. Assuming you are working under linux, the simplest one is the command line gdb, allowing you to execute code line-by-line. More advanced, tailored specifically to memory problems is valgrind.
In the comment you are asking if there is a way for the OS to artifically limit the available memory to a program/process. You can try by reading this question:
https://unix.stackexchange.com/questions/44985/limit-memory-usage-for-a-single-linux-process
however, given the little information you provided, I am not convinced it will solve your problem.
If you have got global variables which allocate memory immediately, i.e. before reaching the first line of code in main(), which could be found for instance in class constructors, then you may consider placing your breakpoints not on the first line of main() but rather on the class constructors. Just as a hint based on a previous similar experience ...

What are my options for cross program communication? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
A while ago i made a database framework in c++ and have been using it in various places, even made a wrapper for it for vb.net.
Now i have a new project that would require multiple programs accessing a single database and it would be wasteful to load up the database multiple times for every one of them not to mention the syncing horrors.
So I figured i would turn the framework into a standalone application and access to the data would be done in some xx magical way from those other programs. From what I've seen php and mysql do something like this..?
Problem is, I have no clue where to start. The only kind of cross program communication i've done is one program reading and writing directly into the other ones memory, seems kinda hacky though and I'm not sure if that sort of thing is going to fly with managed languages (I want to make it accessible in vb.net too).
Tips?
The most portable way to do IPC (inter-process communication) is probably going to be Sockets.
What about D-Bus? There ist a port for Windows.