Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7788001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:51:12+00:00 2026-06-01T20:51:12+00:00

I am trying to identify memleaks in my c++ program. I use Visual Studio

  • 0

I am trying to identify memleaks in my c++ program. I use Visual Studio 2008.

I have found a few tutorials dealing with identifying memleaks while using new, not malloc, for memory allocation and this is what i have defined on top of my main:

#define __STDC_CONSTANT_MACROS 

#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#define new DEBUG_NEW
#endif

unfortunately I get tons of errors, which you can see here: http://pastebin.com/9ax90VTg

But I think I have found the problem: there is neighter __FILE__ nor __LINE__ defined. When I click “RMB->go to definition” OR “RMB->go to declaration” on __FILE__ or __LINE__ I get:

the symbol '__FILE__' is not defined 

and

the symbol '__LINE__  ' is not defined 

respectively.

How should I solve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:51:13+00:00Added an answer on June 1, 2026 at 8:51 pm

    The symbols __FILE__ and __LINE__ should always be defined, by the compiler. If they aren’t, you must be using some special options to inhibit them.

    On the other hand, the code you’ve posted cannot be used with the standard library, and so should be avoided. It is not a good solution for finding memory leaks.

    EDIT: On rereading your posting: you seem to be counting on the debugger to show you the definitions; it can’t, because they are generated automatically by the compiler, changing during compilation. On the other hand, the errors you are seeing are very compatible with the fact that your macro redefines a keyword, in a way that breaks the standard library code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a use case implementation for which I am trying to identify the
I have a table that has redundant data and I'm trying to identify all
I'm trying to use Integrated Windows Authentication combined with a DirectorySearcher to identify and
I was trying to identify the reason behind constants in Java I have learned
Currently, I'm trying to identify which Controller classes in my assembly have the [Authorize]
I have a BW bitmap of similar triangles . I am trying to identify
I am trying to identify private apis of Quartz framework. I have a list
I'm trying to identify a bug in I have in my code where I
I am trying to identify UI-control that fired MotionEvent in Android. I have one
I am trying to identify file types for directory entries (Windows Unix etc..). In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.