Under linux, a CPP service, if the CPU and memory is very high, how should it be checked?

Under

RT,linux, how to troubleshoot a CPP service with high CPU and memory? Trouble a little bit and hope to give a more detailed answer. At present, all I can think of is gdb, but I"m not quite sure how to get gdb.

Mar.11,2021

are you under Linux? Linux before I used a tool Valgrind, can do memory optimization, error checking, etc., it is very easy to use, put your debug version of the program behind the implementation of valgrind on it, he will dynamically collect the information executed by the program for optimization and troubleshooting, very helpful. The disadvantage is that the execution of your program becomes slower.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b1e1-2c264.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b1e1-2c264.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?