Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

272
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda