Panda3D
 All Classes Functions Variables Enumerations
config_interrogatedb.cxx
00001 // Filename: config_interrogatedb.cxx
00002 // Created by:  drose (01Aug00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "config_interrogatedb.h"
00016 #include "interrogate_request.h"
00017 #include "configVariableBool.h"
00018 #include "configVariableSearchPath.h"
00019 #include "dconfig.h"
00020 
00021 #if defined(WIN32_VC) && defined(_DEBUG)
00022 // _DEBUG assumes you are linking to msvcrt70d.dll, not msvcrt70.dll
00023 #define USE_WIN32_DBGHEAP
00024 #include <crtdbg.h>
00025 #endif
00026 
00027 Configure(config_interrogatedb);
00028 NotifyCategoryDef(interrogatedb, "");
00029 
00030 ConfigureFn(config_interrogatedb) {
00031   //  interrogate_request_library("types");
00032 
00033 #ifdef USE_WIN32_DBGHEAP
00034   ConfigVariableBool use_win32_dbgheap("use-win32-dbgheap", false);
00035   ConfigVariableBool win32_report_leaks("win32-report-leaks", false);
00036 
00037   int dbg_flags = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
00038 
00039   if (use_win32_dbgheap.get_string_value() == "full") {
00040     // "full" means check the heap after *every* alloc/dealloc.
00041     // Expensive.
00042     dbg_flags |= (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF |
00043                   _CRTDBG_CHECK_CRT_DF);
00044 
00045   } else {
00046     // Otherwise, it's a bool flag.  true means check the heap
00047     // normally, false means don't do any debug checking.
00048     if (!use_win32_dbgheap) {
00049       // deflt disable complete heap verify every 1024 allocations (VC7 deflt).
00050       // With vc7 stl small-string-optimization causing more allocs, 
00051       // this can cause order-of-magnitude slowdowns in dbg builds
00052       dbg_flags = 0;
00053     }
00054   }
00055 
00056   if (win32_report_leaks) {
00057     // Report memory still allocated at program termination.  Not sure
00058     // how useful this is, as many things get allocated once and never
00059     // freed, but they aren't really leaks.
00060     dbg_flags |= _CRTDBG_LEAK_CHECK_DF;
00061   }
00062 
00063   _CrtSetDbgFlag(dbg_flags);
00064 #endif
00065 }
00066 
00067 ConfigVariableSearchPath interrogatedb_path
00068 ("interrogatedb-path", "The search path for interrogate's *.in files.");
00069 
 All Classes Functions Variables Enumerations