A custom C++ service on a test system gradually consumes all available RAM. Running top shows the process's RES value steadily increasing, and the kernel eventually invokes the OOM killer. You clone the service to a development VM and need a single command that will confirm a heap memory leak and display stack traces for every leaked allocation when the program exits. Which command best meets this requirement?
Running the program under Valgrind's Memcheck tool with the --leak-check=full option instruments every allocation and de-allocation. When the program terminates, Memcheck prints a detailed leak summary that includes the size of each un-freed block and a call stack showing the exact source line where the allocation occurred-precisely the information needed to prove and locate a memory leak. The pmap command can show how much private memory a process owns, but it provides no code-level detail and must be sampled repeatedly. sar -r and vmstat -m report system-wide memory statistics (overall RAM and slab usage) but cannot reveal which lines inside a program allocated leaked memory.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is Valgrind, and why is it used for memory leak detection?
Open an interactive chat with Bash
What is the role of the OOM (Out of Memory) killer in Linux?
Open an interactive chat with Bash
How does `Heap Memory` differ from `Stack Memory`, and why is it relevant here?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Troubleshooting
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .