mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
Add build option for using Visual Leak Detector for debugging memory leaks. Initial report:
- IfcConvert (no arguments): 2 leaks (140 bytes) (from OCE) - IfcConvert (acad2010_objects.ifc): 47 memory leaks (6,158 bytes) - IfcGeomServer: 2 leaks (from OCE) - IfcOpenHouse: 11,952 leaks (1,169,658 bytes)! - IfcParseExamples (acad2010_objects.ifc): 40 memory leaks (4,564 bytes)
This commit is contained in:
@@ -28,6 +28,7 @@ OPTION(ENABLE_BUILD_OPTIMIZATIONS "Enable certain compiler and linker optimizati
|
|||||||
OPTION(USE_IFC4 "Use IFC 4 instead of IFC 2x3 (full rebuild recommended when switching this)" OFF)
|
OPTION(USE_IFC4 "Use IFC 4 instead of IFC 2x3 (full rebuild recommended when switching this)" OFF)
|
||||||
OPTION(BUILD_IFCPYTHON "Build IfcPython." ON)
|
OPTION(BUILD_IFCPYTHON "Build IfcPython." ON)
|
||||||
OPTION(BUILD_EXAMPLES "Build example applications." ON)
|
OPTION(BUILD_EXAMPLES "Build example applications." ON)
|
||||||
|
OPTION(USE_VLC "Use Visual Leak Detector for debugging memory leaks, MSVC-only." OFF)
|
||||||
# TODO QtViewer is deprecated ATM as it uses the 0.4 API
|
# TODO QtViewer is deprecated ATM as it uses the 0.4 API
|
||||||
# OPTION(BUILD_QTVIEWER "Build IfcOpenShell Qt GUI Viewer (requires Qt 4 framework)." OFF)
|
# OPTION(BUILD_QTVIEWER "Build IfcOpenShell Qt GUI Viewer (requires Qt 4 framework)." OFF)
|
||||||
|
|
||||||
@@ -237,6 +238,9 @@ if(ENABLE_BUILD_OPTIMIZATIONS)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
|
IF(USE_VLC)
|
||||||
|
ADD_DEFINITIONS(-DUSE_VLC)
|
||||||
|
ENDIF()
|
||||||
# Enforce Unicode for CRT and Win32 API calls
|
# Enforce Unicode for CRT and Win32 API calls
|
||||||
ADD_DEFINITIONS(-D_UNICODE -DUNICODE)
|
ADD_DEFINITIONS(-D_UNICODE -DUNICODE)
|
||||||
# Disable warnings about unsafe C functions; we could use the safe C99 & C11 versions if we have no need for supporting old compilers.
|
# Disable warnings about unsafe C functions; we could use the safe C99 & C11 versions if we have no need for supporting old compilers.
|
||||||
|
|||||||
@@ -41,6 +41,10 @@
|
|||||||
#include "../ifcparse/IfcHierarchyHelper.h"
|
#include "../ifcparse/IfcHierarchyHelper.h"
|
||||||
#include "../ifcgeom/IfcGeom.h"
|
#include "../ifcgeom/IfcGeom.h"
|
||||||
|
|
||||||
|
#if USE_VLC
|
||||||
|
#include <vld.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// Some convenience typedefs and definitions.
|
// Some convenience typedefs and definitions.
|
||||||
typedef std::string S;
|
typedef std::string S;
|
||||||
typedef IfcParse::IfcGlobalId guid;
|
typedef IfcParse::IfcGlobalId guid;
|
||||||
@@ -531,6 +535,8 @@ void createGroundShape(TopoDS_Shape& shape) {
|
|||||||
TColStd_Array1OfInteger mult(0, 1);
|
TColStd_Array1OfInteger mult(0, 1);
|
||||||
mult(0) = 5;
|
mult(0) = 5;
|
||||||
mult(1) = 5;
|
mult(1) = 5;
|
||||||
|
#undef new
|
||||||
|
|
||||||
Handle(Geom_BSplineSurface) surf = new Geom_BSplineSurface(cv, knots, knots, mult, mult, 4, 4);
|
Handle(Geom_BSplineSurface) surf = new Geom_BSplineSurface(cv, knots, knots, mult, mult, 4, 4);
|
||||||
#if OCC_VERSION_HEX < 0x60502
|
#if OCC_VERSION_HEX < 0x60502
|
||||||
shape = BRepBuilderAPI_MakeFace(surf);
|
shape = BRepBuilderAPI_MakeFace(surf);
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
|
|
||||||
#include "../ifcparse/IfcFile.h"
|
#include "../ifcparse/IfcFile.h"
|
||||||
|
|
||||||
|
#if USE_VLC
|
||||||
|
#include <vld.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace IfcSchema;
|
using namespace IfcSchema;
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
|||||||
@@ -46,6 +46,10 @@
|
|||||||
#include <IGESControl_Controller.hxx>
|
#include <IGESControl_Controller.hxx>
|
||||||
#include <Standard_Version.hxx>
|
#include <Standard_Version.hxx>
|
||||||
|
|
||||||
|
#if USE_VLC
|
||||||
|
#include <vld.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static std::string DEFAULT_EXTENSION = "obj";
|
static std::string DEFAULT_EXTENSION = "obj";
|
||||||
|
|
||||||
void printVersion() {
|
void printVersion() {
|
||||||
|
|||||||
@@ -37,6 +37,10 @@
|
|||||||
|
|
||||||
#include "../ifcgeom/IfcGeomIterator.h"
|
#include "../ifcgeom/IfcGeomIterator.h"
|
||||||
|
|
||||||
|
#if USE_VLC
|
||||||
|
#include <vld.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace boost;
|
using namespace boost;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@@ -282,7 +286,13 @@ public:
|
|||||||
Bye() : Command(BYE) {};
|
Bye() : Command(BYE) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
int main () {
|
int main ()
|
||||||
|
{
|
||||||
|
// Memory leak debugging in MSVC debug mode
|
||||||
|
#if defined(_MSC_VER) && defined(_DEBUG)
|
||||||
|
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Redirect stdout to this stream, so that involuntary
|
// Redirect stdout to this stream, so that involuntary
|
||||||
// writes to stdout do not interfere with our protocol.
|
// writes to stdout do not interfere with our protocol.
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
|
|||||||
Reference in New Issue
Block a user