Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

270
Views
Can I debug memory leakage using _CrtDumpMemoryLeaks() in VSCode?

I am newbie to VSCode. Currently I would like to debug the memory leakage issue in the program. Therefore after searching the internet, I found that _CrtDumpMemoryLeaks() can be used to debug which line of code cause the memory leak issue. Therefore I wrote a C program in VSCode.

#include<stdio.h>
#include<stdlib.h>
#include <crtdbg.h>
int main (int argc, char* argv[])
{
    int* offset_x = malloc(sizeof(int));
    int* offset_y = malloc(sizeof(int));
    if (offset_x==NULL || offset_y == NULL)
    {
         return 1;
     }
     *offset_x =10;
     *offset_y = 20;
     printf("%d",offset_x);
     free(offset_x);
     _CrtDumpMemoryLeaks();
     return 0;
}

After running the program in VSCode, I got an error of

crtdbg.h: No such file or directory

in VSCode. I found crtdbg.h library is already inside the "C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt".

In the internet most of the c programs are run in visual studio community instead of VSCode to debug the memory leak issue.

Therefore, I would like to know if I want to use VSCode to debug the memory leak problem, can I use _CrtDumpMemoryLeaks() and how can I solve the problem of "crtdbg.h: No such file or directory" in VSCode as I think I already had crtdbg.h in "C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt" and I don't know why VSCode said no such file or directory.

Thank you.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!