Panda3D
config_interrogatedb.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file config_interrogatedb.cxx
10  * @author drose
11  * @date 2000-08-01
12  */
13 
14 #include "config_interrogatedb.h"
15 #include "interrogate_request.h"
16 #include "configVariableBool.h"
18 #include "dconfig.h"
19 
20 #if defined(WIN32_VC) && defined(_DEBUG)
21 // _DEBUG assumes you are linking to msvcrt70d.dll, not msvcrt70.dll
22 #define USE_WIN32_DBGHEAP
23 #include <crtdbg.h>
24 #endif
25 
26 Configure(config_interrogatedb);
27 NotifyCategoryDef(interrogatedb, "");
28 
29 ConfigureFn(config_interrogatedb) {
30  // interrogate_request_library("types");
31 
32 #ifdef USE_WIN32_DBGHEAP
33  ConfigVariableBool use_win32_dbgheap("use-win32-dbgheap", false);
34  ConfigVariableBool win32_report_leaks("win32-report-leaks", false);
35 
36  int dbg_flags = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
37 
38  if (use_win32_dbgheap.get_string_value() == "full") {
39  // "full" means check the heap after *every* allocdealloc. Expensive.
40  dbg_flags |= (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF |
41  _CRTDBG_CHECK_CRT_DF);
42 
43  } else {
44  // Otherwise, it's a bool flag. true means check the heap normally, false
45  // means don't do any debug checking.
46  if (!use_win32_dbgheap) {
47  // deflt disable complete heap verify every 1024 allocations (VC7
48  // deflt). With vc7 stl small-string-optimization causing more allocs,
49  // this can cause order-of-magnitude slowdowns in dbg builds
50  dbg_flags = 0;
51  }
52  }
53 
54  if (win32_report_leaks) {
55  // Report memory still allocated at program termination. Not sure how
56  // useful this is, as many things get allocated once and never freed, but
57  // they aren't really leaks.
58  dbg_flags |= _CRTDBG_LEAK_CHECK_DF;
59  }
60 
61  _CrtSetDbgFlag(dbg_flags);
62 #endif
63 }
64 
65 ConfigVariableSearchPath interrogatedb_path
66 ("interrogatedb-path", "The search path for interrogate's *.in files.");
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is similar to a ConfigVariableList, but it returns its list as a DSearchPath,...
This is a convenience class to specialize ConfigVariable as a boolean type.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.