mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
fix memory crashes on win32/Eigen build
This commit is contained in:
parent
e9b967435e
commit
6e5dd2cc63
@ -289,10 +289,6 @@
|
|||||||
// We need 64-bit file i/o
|
// We need 64-bit file i/o
|
||||||
#define __USE_LARGEFILE64 1
|
#define __USE_LARGEFILE64 1
|
||||||
|
|
||||||
// Modern versions of gcc do support the latest STL allocator
|
|
||||||
// definitions.
|
|
||||||
#define USE_STL_ALLOCATOR 1
|
|
||||||
|
|
||||||
// The dynamic library file extension (usually .so .dll or .dylib):
|
// The dynamic library file extension (usually .so .dll or .dylib):
|
||||||
#define DYNAMIC_LIB_EXT .so
|
#define DYNAMIC_LIB_EXT .so
|
||||||
#define STATIC_LIB_EXT .a
|
#define STATIC_LIB_EXT .a
|
||||||
|
@ -332,10 +332,6 @@
|
|||||||
// We need 64-bit file i/o
|
// We need 64-bit file i/o
|
||||||
#define __USE_LARGEFILE64 1
|
#define __USE_LARGEFILE64 1
|
||||||
|
|
||||||
// Modern versions of gcc do support the latest STL allocator
|
|
||||||
// definitions.
|
|
||||||
#define USE_STL_ALLOCATOR 1
|
|
||||||
|
|
||||||
// The dynamic library file extension (usually .so .dll or .dylib):
|
// The dynamic library file extension (usually .so .dll or .dylib):
|
||||||
#define DYNAMIC_LIB_EXT .so
|
#define DYNAMIC_LIB_EXT .so
|
||||||
#define STATIC_LIB_EXT .a
|
#define STATIC_LIB_EXT .a
|
||||||
|
@ -277,10 +277,6 @@
|
|||||||
// Do we have RTTI (and <typeinfo>)?
|
// Do we have RTTI (and <typeinfo>)?
|
||||||
#define HAVE_RTTI 1
|
#define HAVE_RTTI 1
|
||||||
|
|
||||||
// Modern versions of gcc do support the latest STL allocator
|
|
||||||
// definitions.
|
|
||||||
#define USE_STL_ALLOCATOR 1
|
|
||||||
|
|
||||||
// Do we have <stdint.h>?
|
// Do we have <stdint.h>?
|
||||||
#define PHAVE_STDINT_H 1
|
#define PHAVE_STDINT_H 1
|
||||||
|
|
||||||
|
@ -160,9 +160,6 @@
|
|||||||
// Do we have <stdint.h>?
|
// Do we have <stdint.h>?
|
||||||
#define PHAVE_STDINT_H
|
#define PHAVE_STDINT_H
|
||||||
|
|
||||||
// MSVC7 does support the latest STL allocator definitions.
|
|
||||||
#define USE_STL_ALLOCATOR 1
|
|
||||||
|
|
||||||
// can Intel C++ build this directory successfully (if not, change CC to msvc)
|
// can Intel C++ build this directory successfully (if not, change CC to msvc)
|
||||||
#define NOT_INTEL_BUILDABLE false
|
#define NOT_INTEL_BUILDABLE false
|
||||||
|
|
||||||
|
@ -160,9 +160,6 @@
|
|||||||
// Do we have <stdint.h>?
|
// Do we have <stdint.h>?
|
||||||
#define PHAVE_STDINT_H
|
#define PHAVE_STDINT_H
|
||||||
|
|
||||||
// MSVC7 does support the latest STL allocator definitions.
|
|
||||||
#define USE_STL_ALLOCATOR 1
|
|
||||||
|
|
||||||
// can Intel C++ build this directory successfully (if not, change CC to msvc)
|
// can Intel C++ build this directory successfully (if not, change CC to msvc)
|
||||||
#define NOT_INTEL_BUILDABLE false
|
#define NOT_INTEL_BUILDABLE false
|
||||||
|
|
||||||
|
@ -381,6 +381,13 @@
|
|||||||
// on DirectX rendering.
|
// on DirectX rendering.
|
||||||
#defer SUPPORT_IMMEDIATE_MODE $[<= $[OPTIMIZE], 3]
|
#defer SUPPORT_IMMEDIATE_MODE $[<= $[OPTIMIZE], 3]
|
||||||
|
|
||||||
|
// These are two optional alternative memory-allocation schemes
|
||||||
|
// available within Panda. You can experiment with either of them to
|
||||||
|
// see if they give better performance than the system malloc(), but
|
||||||
|
// at the time of this writing, it doesn't appear that they do.
|
||||||
|
#define USE_MEMORY_DLMALLOC
|
||||||
|
#define USE_MEMORY_PTMALLOC2
|
||||||
|
|
||||||
// Panda contains some experimental code to compile for IPhone. This
|
// Panda contains some experimental code to compile for IPhone. This
|
||||||
// requires the Apple IPhone SDK, which is currently only available
|
// requires the Apple IPhone SDK, which is currently only available
|
||||||
// for OS X platforms. Set this to either "iPhoneSimulator" or
|
// for OS X platforms. Set this to either "iPhoneSimulator" or
|
||||||
|
@ -501,6 +501,10 @@ $[cdefine SIMULATE_NETWORK_DELAY]
|
|||||||
/* Define if we want to allow immediate mode OpenGL rendering. */
|
/* Define if we want to allow immediate mode OpenGL rendering. */
|
||||||
$[cdefine SUPPORT_IMMEDIATE_MODE]
|
$[cdefine SUPPORT_IMMEDIATE_MODE]
|
||||||
|
|
||||||
|
/* Define for either of the alternative malloc schemes. */
|
||||||
|
$[cdefine USE_MEMORY_DLMALLOC]
|
||||||
|
$[cdefine USE_MEMORY_PTMALLOC2]
|
||||||
|
|
||||||
/* Define if we want to compile in support for pipelining. */
|
/* Define if we want to compile in support for pipelining. */
|
||||||
$[cdefine DO_PIPELINING]
|
$[cdefine DO_PIPELINING]
|
||||||
|
|
||||||
@ -695,38 +699,6 @@ $[cdefine USE_TAU]
|
|||||||
/* Define if needed to have 64-bit file i/o */
|
/* Define if needed to have 64-bit file i/o */
|
||||||
$[cdefine __USE_LARGEFILE64]
|
$[cdefine __USE_LARGEFILE64]
|
||||||
|
|
||||||
/* Which memory allocation scheme should we use? */
|
|
||||||
#define USE_MEMORY_DLMALLOC
|
|
||||||
#define USE_MEMORY_PTMALLOC2
|
|
||||||
#define USE_MEMORY_MALLOC
|
|
||||||
#define USE_MEMORY_NOWRAPPERS
|
|
||||||
#if $[ALTERNATIVE_MALLOC]
|
|
||||||
#if $[and $[WIN32_PLATFORM], $[HAVE_THREADS], $[not $[SIMPLE_THREADS]]]
|
|
||||||
// A fast thread-safe alternative implementation, but which only
|
|
||||||
// seems to be a good choice on Windows. (It crashes on Linux and
|
|
||||||
// isn't thread-safe on OSX).
|
|
||||||
#set USE_MEMORY_PTMALLOC2 1
|
|
||||||
#else
|
|
||||||
// A faster, but non-thread-safe, alternative implementation.
|
|
||||||
// When threading support is compiled in, we use a global mutex to
|
|
||||||
// protect it.
|
|
||||||
#set USE_MEMORY_DLMALLOC 1
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#if $[DO_MEMORY_USAGE]
|
|
||||||
// Redefine new and delete to malloc(), and also provide hooks for
|
|
||||||
// the benefit of the MemoryUsage class.
|
|
||||||
#set USE_MEMORY_MALLOC 1
|
|
||||||
#else
|
|
||||||
// Don't redefine new and delete at all.
|
|
||||||
#set USE_MEMORY_NOWRAPPERS 1
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
$[cdefine USE_MEMORY_DLMALLOC]
|
|
||||||
$[cdefine USE_MEMORY_PTMALLOC2]
|
|
||||||
$[cdefine USE_MEMORY_MALLOC]
|
|
||||||
$[cdefine USE_MEMORY_NOWRAPPERS]
|
|
||||||
|
|
||||||
// To activate the DELETED_CHAIN macros.
|
// To activate the DELETED_CHAIN macros.
|
||||||
$[cdefine USE_DELETED_CHAIN]
|
$[cdefine USE_DELETED_CHAIN]
|
||||||
|
|
||||||
@ -740,10 +712,6 @@ $[cdefine WANT_NATIVE_NET]
|
|||||||
# pragma warning( disable : 4996 4275 4267 4099 4049 4013 4005 )
|
# pragma warning( disable : 4996 4275 4267 4099 4049 4013 4005 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Can we define a modern-style STL allocator? */
|
|
||||||
$[cdefine USE_STL_ALLOCATOR]
|
|
||||||
|
|
||||||
/* Static linkage instead of the normal dynamic linkage? */
|
/* Static linkage instead of the normal dynamic linkage? */
|
||||||
$[cdefine LINK_ALL_STATIC]
|
$[cdefine LINK_ALL_STATIC]
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@
|
|||||||
#define LDFLAGS_OPT3 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF
|
#define LDFLAGS_OPT3 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF
|
||||||
#define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF $[LDFLAGS_OPT4]
|
#define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF $[LDFLAGS_OPT4]
|
||||||
|
|
||||||
#define COMMONFLAGS /DHAVE_DINKUM /Zc:forScope
|
#define COMMONFLAGS /DHAVE_DINKUM /Zc:forScope /bigobj
|
||||||
|
|
||||||
// use "unsafe" QIfist flt->int rounding only if FAST_FLT_TO_INT is defined
|
// use "unsafe" QIfist flt->int rounding only if FAST_FLT_TO_INT is defined
|
||||||
#define REGULAR_OPTFLAGS /O2 /Ob2 $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,]
|
#define REGULAR_OPTFLAGS /O2 /Ob2 $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,]
|
||||||
@ -260,8 +260,7 @@
|
|||||||
#define LDFLAGS_OPT3 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF
|
#define LDFLAGS_OPT3 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF
|
||||||
#define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF $[LDFLAGS_OPT4]
|
#define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF $[LDFLAGS_OPT4]
|
||||||
|
|
||||||
// use /bigobj in 64-bit environment
|
#define COMMONFLAGS /DHAVE_DINKUM /Zc:forScope /bigobj
|
||||||
#define COMMONFLAGS /DHAVE_DINKUM /Zc:forScope $[if $[eq $[USE_COMPILER],MSVC9x64], /bigobj,]
|
|
||||||
|
|
||||||
// use "unsafe" QIfist flt->int rounding only if FAST_FLT_TO_INT is defined
|
// use "unsafe" QIfist flt->int rounding only if FAST_FLT_TO_INT is defined
|
||||||
#define REGULAR_OPTFLAGS /O2 /Ob2 $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,]
|
#define REGULAR_OPTFLAGS /O2 /Ob2 $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,]
|
||||||
|
@ -336,6 +336,18 @@
|
|||||||
#define ALIGN_16BYTE
|
#define ALIGN_16BYTE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Determine our memory-allocation requirements. */
|
||||||
|
#if defined(USE_MEMORY_PTMALLOC2) || defined(USE_MEMORY_DLMALLOC) || defined(DO_MEMORY_USAGE)
|
||||||
|
/* If we are using our own alternative malloc, or if we're building
|
||||||
|
with DO_MEMORY_USAGE in effect, it follows we need to use our
|
||||||
|
custom STL allocator. */
|
||||||
|
#define USE_STL_ALLOCATOR 1
|
||||||
|
#else
|
||||||
|
/* Otherwise, if we have no custom memory management needs at all, we
|
||||||
|
might as well turn it all off and go straight to the OS-level
|
||||||
|
calls. */
|
||||||
|
#define USE_MEMORY_NOWRAPPERS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We define the macros BEGIN_PUBLISH and END_PUBLISH to bracket
|
We define the macros BEGIN_PUBLISH and END_PUBLISH to bracket
|
||||||
|
@ -23,24 +23,31 @@
|
|||||||
|
|
||||||
class DeletedBufferChain;
|
class DeletedBufferChain;
|
||||||
|
|
||||||
|
|
||||||
// Do we need to implement memory-alignment enforcement within the
|
// Do we need to implement memory-alignment enforcement within the
|
||||||
// MemoryHook class, or will the underlying malloc implementation
|
// MemoryHook class, or will the underlying malloc implementation
|
||||||
// provide it automatically?
|
// provide it automatically?
|
||||||
#if defined(USE_MEMORY_DLMALLOC) || defined(USE_MEMORY_PTMALLOC2)
|
#if !defined(LINMATH_ALIGN)
|
||||||
// Both of these specialized malloc implementations perform the
|
// We don't actually require any special memory-alignment beyond what
|
||||||
// required alignment.
|
// the underlying implementation is likely to provide anyway.
|
||||||
#undef MEMORY_HOOK_DO_ALIGN
|
#undef MEMORY_HOOK_DO_ALIGN
|
||||||
|
|
||||||
|
#elif defined(USE_MEMORY_DLMALLOC)
|
||||||
|
// This specialized malloc implementation can perform the required
|
||||||
|
// alignment.
|
||||||
|
#undef MEMORY_HOOK_DO_ALIGN
|
||||||
|
|
||||||
|
#elif defined(USE_MEMORY_PTMALLOC2)
|
||||||
|
// But not this one. For some reason it crashes when we try to build
|
||||||
|
// it with alignment 16. So if we're using ptmalloc2, we need to
|
||||||
|
// enforce alignment externally.
|
||||||
|
#define MEMORY_HOOK_DO_ALIGN 1
|
||||||
|
|
||||||
#elif defined(IS_OSX) || defined(_WIN64)
|
#elif defined(IS_OSX) || defined(_WIN64)
|
||||||
// The OS-provided malloc implementation will do the required
|
// The OS-provided malloc implementation will do the required
|
||||||
// alignment.
|
// alignment.
|
||||||
#undef MEMORY_HOOK_DO_ALIGN
|
#undef MEMORY_HOOK_DO_ALIGN
|
||||||
|
|
||||||
#elif !defined(LINMATH_ALIGN)
|
|
||||||
// We don't actually require any special memory-alignment beyond what
|
|
||||||
// the underlying implementation is likely to provide anyway.
|
|
||||||
#undef MEMORY_HOOK_DO_ALIGN
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// Whoops, we need memory alignment, and we have to provide it ourselves.
|
// Whoops, we need memory alignment, and we have to provide it ourselves.
|
||||||
#define MEMORY_HOOK_DO_ALIGN 1
|
#define MEMORY_HOOK_DO_ALIGN 1
|
||||||
|
@ -749,12 +749,8 @@ extern "C" {
|
|||||||
are optimized for the case of 8-byte alignment.
|
are optimized for the case of 8-byte alignment.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef LINMATH_ALIGN
|
/* drose: it turns out that setting MALLOC_ALIGNMENT to 16 doesn't
|
||||||
// drose: We require 16-byte alignment of certain structures, to
|
work; something crashes internally. Too bad. */
|
||||||
// support SSE2. We don't strictly have to align *everything*, but
|
|
||||||
// it's just easier to do so.
|
|
||||||
#define MALLOC_ALIGNMENT ((size_t)16U)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef MALLOC_ALIGNMENT
|
#ifndef MALLOC_ALIGNMENT
|
||||||
#define MALLOC_ALIGNMENT (2 * SIZE_SZ)
|
#define MALLOC_ALIGNMENT (2 * SIZE_SZ)
|
||||||
|
@ -1526,10 +1526,6 @@ DTOOL_CONFIG=[
|
|||||||
("IS_OSX", 'UNDEF', 'UNDEF'),
|
("IS_OSX", 'UNDEF', 'UNDEF'),
|
||||||
("IS_FREEBSD", 'UNDEF', 'UNDEF'),
|
("IS_FREEBSD", 'UNDEF', 'UNDEF'),
|
||||||
("GLOBAL_OPERATOR_NEW_EXCEPTIONS", 'UNDEF', '1'),
|
("GLOBAL_OPERATOR_NEW_EXCEPTIONS", 'UNDEF', '1'),
|
||||||
("USE_STL_ALLOCATOR", '1', '1'),
|
|
||||||
("USE_MEMORY_DLMALLOC", 'UNDEF', 'UNDEF'),
|
|
||||||
("USE_MEMORY_PTMALLOC2", '1', 'UNDEF'),
|
|
||||||
("USE_MEMORY_MALLOC", 'UNDEF', '1'),
|
|
||||||
("HAVE_EIGEN", 'UNDEF', 'UNDEF'),
|
("HAVE_EIGEN", 'UNDEF', 'UNDEF'),
|
||||||
("LINMATH_ALIGN", '1', '1'),
|
("LINMATH_ALIGN", '1', '1'),
|
||||||
("HAVE_ZLIB", 'UNDEF', 'UNDEF'),
|
("HAVE_ZLIB", 'UNDEF', 'UNDEF'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user