Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

273
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda