diff --git a/Makefile.in b/Makefile.in index a00a80e967..1ac008bef6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -872,7 +872,6 @@ ALL_BASE_SOURCES = \ src/common/list.cpp \ src/common/log.cpp \ src/common/longlong.cpp \ - src/common/memory.cpp \ src/common/mimecmn.cpp \ src/common/module.cpp \ src/common/mstream.cpp \ @@ -1064,7 +1063,6 @@ MONODLL_OBJECTS = \ monodll_list.o \ monodll_log.o \ monodll_longlong.o \ - monodll_memory.o \ monodll_mimecmn.o \ monodll_module.o \ monodll_mstream.o \ @@ -1210,7 +1208,6 @@ MONOLIB_OBJECTS = \ monolib_list.o \ monolib_log.o \ monolib_longlong.o \ - monolib_memory.o \ monolib_mimecmn.o \ monolib_module.o \ monolib_mstream.o \ @@ -1340,7 +1337,6 @@ BASEDLL_OBJECTS = \ basedll_list.o \ basedll_log.o \ basedll_longlong.o \ - basedll_memory.o \ basedll_mimecmn.o \ basedll_module.o \ basedll_mstream.o \ @@ -1452,7 +1448,6 @@ BASELIB_OBJECTS = \ baselib_list.o \ baselib_log.o \ baselib_longlong.o \ - baselib_memory.o \ baselib_mimecmn.o \ baselib_module.o \ baselib_mstream.o \ @@ -14750,9 +14745,6 @@ monodll_log.o: $(srcdir)/src/common/log.cpp $(MONODLL_ODEP) monodll_longlong.o: $(srcdir)/src/common/longlong.cpp $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/longlong.cpp -monodll_memory.o: $(srcdir)/src/common/memory.cpp $(MONODLL_ODEP) - $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/memory.cpp - monodll_mimecmn.o: $(srcdir)/src/common/mimecmn.cpp $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/mimecmn.cpp @@ -19517,9 +19509,6 @@ monolib_log.o: $(srcdir)/src/common/log.cpp $(MONOLIB_ODEP) monolib_longlong.o: $(srcdir)/src/common/longlong.cpp $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/longlong.cpp -monolib_memory.o: $(srcdir)/src/common/memory.cpp $(MONOLIB_ODEP) - $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/memory.cpp - monolib_mimecmn.o: $(srcdir)/src/common/mimecmn.cpp $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/mimecmn.cpp @@ -24284,9 +24273,6 @@ basedll_log.o: $(srcdir)/src/common/log.cpp $(BASEDLL_ODEP) basedll_longlong.o: $(srcdir)/src/common/longlong.cpp $(BASEDLL_ODEP) $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/longlong.cpp -basedll_memory.o: $(srcdir)/src/common/memory.cpp $(BASEDLL_ODEP) - $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/memory.cpp - basedll_mimecmn.o: $(srcdir)/src/common/mimecmn.cpp $(BASEDLL_ODEP) $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/mimecmn.cpp @@ -24770,9 +24756,6 @@ baselib_log.o: $(srcdir)/src/common/log.cpp $(BASELIB_ODEP) baselib_longlong.o: $(srcdir)/src/common/longlong.cpp $(BASELIB_ODEP) $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/longlong.cpp -baselib_memory.o: $(srcdir)/src/common/memory.cpp $(BASELIB_ODEP) - $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/memory.cpp - baselib_mimecmn.o: $(srcdir)/src/common/mimecmn.cpp $(BASELIB_ODEP) $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/mimecmn.cpp diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 346e1490b1..470247f1ad 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -530,7 +530,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/common/list.cpp src/common/log.cpp src/common/longlong.cpp - src/common/memory.cpp src/common/mimecmn.cpp src/common/module.cpp src/common/mstream.cpp diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake index b92a6320c1..4c81a1a2b1 100644 --- a/build/cmake/files.cmake +++ b/build/cmake/files.cmake @@ -442,7 +442,6 @@ set(BASE_CMN_SRC src/common/list.cpp src/common/log.cpp src/common/longlong.cpp - src/common/memory.cpp src/common/mimecmn.cpp src/common/module.cpp src/common/mstream.cpp diff --git a/build/cmake/setup.h.in b/build/cmake/setup.h.in index 2d2d36c6fe..1bca69cbd2 100644 --- a/build/cmake/setup.h.in +++ b/build/cmake/setup.h.in @@ -138,16 +138,6 @@ -#cmakedefine01 wxUSE_DEBUG_CONTEXT - -#cmakedefine01 wxUSE_MEMORY_TRACING - -#cmakedefine01 wxUSE_GLOBAL_MEMORY_OPERATORS - -#cmakedefine01 wxUSE_DEBUG_NEW_ALWAYS - - - #cmakedefine01 wxUSE_EXCEPTIONS #cmakedefine01 wxUSE_EXTENDED_RTTI diff --git a/build/files b/build/files index ae248eac52..7246a8e599 100644 --- a/build/files +++ b/build/files @@ -461,7 +461,6 @@ BASE_CMN_SRC = src/common/log.cpp src/common/longlong.cpp src/common/lzmastream.cpp - src/common/memory.cpp src/common/mimecmn.cpp src/common/module.cpp src/common/mstream.cpp diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index 40ae7d393a..56344ad17d 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -443,7 +443,6 @@ MONODLL_OBJECTS = \ $(OBJS)\monodll_list.o \ $(OBJS)\monodll_log.o \ $(OBJS)\monodll_longlong.o \ - $(OBJS)\monodll_memory.o \ $(OBJS)\monodll_mimecmn.o \ $(OBJS)\monodll_module.o \ $(OBJS)\monodll_mstream.o \ @@ -602,7 +601,6 @@ MONOLIB_OBJECTS = \ $(OBJS)\monolib_list.o \ $(OBJS)\monolib_log.o \ $(OBJS)\monolib_longlong.o \ - $(OBJS)\monolib_memory.o \ $(OBJS)\monolib_mimecmn.o \ $(OBJS)\monolib_module.o \ $(OBJS)\monolib_mstream.o \ @@ -753,7 +751,6 @@ BASEDLL_OBJECTS = \ $(OBJS)\basedll_list.o \ $(OBJS)\basedll_log.o \ $(OBJS)\basedll_longlong.o \ - $(OBJS)\basedll_memory.o \ $(OBJS)\basedll_mimecmn.o \ $(OBJS)\basedll_module.o \ $(OBJS)\basedll_mstream.o \ @@ -885,7 +882,6 @@ BASELIB_OBJECTS = \ $(OBJS)\baselib_list.o \ $(OBJS)\baselib_log.o \ $(OBJS)\baselib_longlong.o \ - $(OBJS)\baselib_memory.o \ $(OBJS)\baselib_mimecmn.o \ $(OBJS)\baselib_module.o \ $(OBJS)\baselib_mstream.o \ @@ -7061,9 +7057,6 @@ $(OBJS)\monodll_log.o: ../../src/common/log.cpp $(OBJS)\monodll_longlong.o: ../../src/common/longlong.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< -$(OBJS)\monodll_memory.o: ../../src/common/memory.cpp - $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< - $(OBJS)\monodll_mimecmn.o: ../../src/common/mimecmn.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< @@ -9651,9 +9644,6 @@ $(OBJS)\monolib_log.o: ../../src/common/log.cpp $(OBJS)\monolib_longlong.o: ../../src/common/longlong.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< -$(OBJS)\monolib_memory.o: ../../src/common/memory.cpp - $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< - $(OBJS)\monolib_mimecmn.o: ../../src/common/mimecmn.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< @@ -12241,9 +12231,6 @@ $(OBJS)\basedll_log.o: ../../src/common/log.cpp $(OBJS)\basedll_longlong.o: ../../src/common/longlong.cpp $(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $< -$(OBJS)\basedll_memory.o: ../../src/common/memory.cpp - $(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $< - $(OBJS)\basedll_mimecmn.o: ../../src/common/mimecmn.cpp $(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $< @@ -12589,9 +12576,6 @@ $(OBJS)\baselib_log.o: ../../src/common/log.cpp $(OBJS)\baselib_longlong.o: ../../src/common/longlong.cpp $(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $< -$(OBJS)\baselib_memory.o: ../../src/common/memory.cpp - $(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $< - $(OBJS)\baselib_mimecmn.o: ../../src/common/mimecmn.cpp $(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $< diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index 9e4ef9fdaf..8c5e0463df 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -473,7 +473,6 @@ MONODLL_OBJECTS = \ $(OBJS)\monodll_list.obj \ $(OBJS)\monodll_log.obj \ $(OBJS)\monodll_longlong.obj \ - $(OBJS)\monodll_memory.obj \ $(OBJS)\monodll_mimecmn.obj \ $(OBJS)\monodll_module.obj \ $(OBJS)\monodll_mstream.obj \ @@ -639,7 +638,6 @@ MONOLIB_OBJECTS = \ $(OBJS)\monolib_list.obj \ $(OBJS)\monolib_log.obj \ $(OBJS)\monolib_longlong.obj \ - $(OBJS)\monolib_memory.obj \ $(OBJS)\monolib_mimecmn.obj \ $(OBJS)\monolib_module.obj \ $(OBJS)\monolib_mstream.obj \ @@ -799,7 +797,6 @@ BASEDLL_OBJECTS = \ $(OBJS)\basedll_list.obj \ $(OBJS)\basedll_log.obj \ $(OBJS)\basedll_longlong.obj \ - $(OBJS)\basedll_memory.obj \ $(OBJS)\basedll_mimecmn.obj \ $(OBJS)\basedll_module.obj \ $(OBJS)\basedll_mstream.obj \ @@ -941,7 +938,6 @@ BASELIB_OBJECTS = \ $(OBJS)\baselib_list.obj \ $(OBJS)\baselib_log.obj \ $(OBJS)\baselib_longlong.obj \ - $(OBJS)\baselib_memory.obj \ $(OBJS)\baselib_mimecmn.obj \ $(OBJS)\baselib_module.obj \ $(OBJS)\baselib_mstream.obj \ @@ -7506,9 +7502,6 @@ $(OBJS)\monodll_log.obj: ..\..\src\common\log.cpp $(OBJS)\monodll_longlong.obj: ..\..\src\common\longlong.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\longlong.cpp -$(OBJS)\monodll_memory.obj: ..\..\src\common\memory.cpp - $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\memory.cpp - $(OBJS)\monodll_mimecmn.obj: ..\..\src\common\mimecmn.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\mimecmn.cpp @@ -10096,9 +10089,6 @@ $(OBJS)\monolib_log.obj: ..\..\src\common\log.cpp $(OBJS)\monolib_longlong.obj: ..\..\src\common\longlong.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\longlong.cpp -$(OBJS)\monolib_memory.obj: ..\..\src\common\memory.cpp - $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\memory.cpp - $(OBJS)\monolib_mimecmn.obj: ..\..\src\common\mimecmn.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\mimecmn.cpp @@ -12686,9 +12676,6 @@ $(OBJS)\basedll_log.obj: ..\..\src\common\log.cpp $(OBJS)\basedll_longlong.obj: ..\..\src\common\longlong.cpp $(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\longlong.cpp -$(OBJS)\basedll_memory.obj: ..\..\src\common\memory.cpp - $(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\memory.cpp - $(OBJS)\basedll_mimecmn.obj: ..\..\src\common\mimecmn.cpp $(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\mimecmn.cpp @@ -13034,9 +13021,6 @@ $(OBJS)\baselib_log.obj: ..\..\src\common\log.cpp $(OBJS)\baselib_longlong.obj: ..\..\src\common\longlong.cpp $(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\longlong.cpp -$(OBJS)\baselib_memory.obj: ..\..\src\common\memory.cpp - $(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\memory.cpp - $(OBJS)\baselib_mimecmn.obj: ..\..\src\common\mimecmn.cpp $(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\mimecmn.cpp diff --git a/build/msw/wx_base.vcxproj b/build/msw/wx_base.vcxproj index 13eaef3b46..d20b5348f7 100644 --- a/build/msw/wx_base.vcxproj +++ b/build/msw/wx_base.vcxproj @@ -517,7 +517,6 @@ - diff --git a/build/msw/wx_base.vcxproj.filters b/build/msw/wx_base.vcxproj.filters index cb7f943554..857858a0f3 100644 --- a/build/msw/wx_base.vcxproj.filters +++ b/build/msw/wx_base.vcxproj.filters @@ -162,9 +162,6 @@ Common Sources - - Common Sources - Common Sources diff --git a/build/osx/wxcocoa.xcodeproj/project.pbxproj b/build/osx/wxcocoa.xcodeproj/project.pbxproj index dbe22de8c5..9f79c00c7d 100644 --- a/build/osx/wxcocoa.xcodeproj/project.pbxproj +++ b/build/osx/wxcocoa.xcodeproj/project.pbxproj @@ -393,7 +393,6 @@ F6B85CD918E93923BE631B95 /* fs_filter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AAB58DD0DEC13D68B8708085 /* fs_filter.cpp */; }; 215958201947310B88BBEDB3 /* statbmp.mm in Sources */ = {isa = PBXBuildFile; fileRef = FD6B26B5A6A733A89EF5AB9C /* statbmp.mm */; }; D088E7DDE38C31DC9C9B3417 /* dcclient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B17772732159304AA7312D72 /* dcclient.cpp */; }; - DC978B60F6DF3176B5B114C3 /* memory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5466CC2D6579360E9C665EE5 /* memory.cpp */; }; E0E4885BF4AF34B48EB08B91 /* volume.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6506A965F677374491359FB8 /* volume.mm */; }; 8F949B9010863F66A58FFEF1 /* xh_activityindicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BB60FA0E3524391D8581AD7C /* xh_activityindicator.cpp */; }; 36DB80FD5B153E9099DB6913 /* imaggif.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDB4AB7CDABA3A54B4F8207B /* imaggif.cpp */; }; @@ -1898,7 +1897,6 @@ 22C76BF2C3E331CD87657E6F /* LexNsis.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1BC0322549563787A21CE8F1 /* LexNsis.cxx */; }; C92005CB86C6361BBB9D7C69 /* LexBibTeX.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 0851C46057CE3C37991B9E34 /* LexBibTeX.cxx */; }; 8A4046BD38873D9CAC9C2B5A /* filesys.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F263022F3FEA3F75895B644D /* filesys.cpp */; }; - DC978B60F6DF3176B5B114C4 /* memory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5466CC2D6579360E9C665EE5 /* memory.cpp */; }; 8A4046BD38873D9CAC9C2B5B /* filesys.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F263022F3FEA3F75895B644D /* filesys.cpp */; }; 1A70DDEDF9E13FF4BDA390E9 /* bmpbndl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B1A8E72B8E531B28C6DFD7A /* bmpbndl.mm */; }; FE9A662A1F9B34D099C45C1E /* xh_cald.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 093B5233861B3F9B8C85762B /* xh_cald.cpp */; }; @@ -2814,7 +2812,6 @@ 552708E6296D33EBB5F6A495 /* tif_swab.c in Sources */ = {isa = PBXBuildFile; fileRef = AAC12B4456E13F57BEA25A5E /* tif_swab.c */; }; 82FA4AA043213728AC266702 /* wizard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8F08F70E1EF239999A4D2AC4 /* wizard.cpp */; }; 1EA81A0E8E5A3B38B4D80339 /* srchcmn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1EF103B09F02315282EC8F44 /* srchcmn.cpp */; }; - DC978B60F6DF3176B5B114C5 /* memory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5466CC2D6579360E9C665EE5 /* memory.cpp */; }; BF3D600A93403C589B65C5C1 /* xh_stlin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5F555177554E398286DBC6FB /* xh_stlin.cpp */; }; 7B4DA2F5F25B3E188CBAFE3A /* hyperlnkcmn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A7D521FE5B437D7AD5F4B54 /* hyperlnkcmn.cpp */; }; 9836B3D336963795928FE5A3 /* m_dflist.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52FE1599218730CC99A3F801 /* m_dflist.cpp */; }; @@ -4381,7 +4378,6 @@ 11AE4D94B791344AB6BF6397 /* xh_bmpbt.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = xh_bmpbt.cpp; path = ../../src/xrc/xh_bmpbt.cpp; sourceTree = SOURCE_ROOT; }; A881F49ADCF33C299B041584 /* floatpane.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = floatpane.cpp; path = ../../src/aui/floatpane.cpp; sourceTree = SOURCE_ROOT; }; 56653FACC7D13804A70556AD /* sckfile.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = sckfile.cpp; path = ../../src/common/sckfile.cpp; sourceTree = SOURCE_ROOT; }; - 5466CC2D6579360E9C665EE5 /* memory.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = memory.cpp; path = ../../src/common/memory.cpp; sourceTree = SOURCE_ROOT; }; B568A7364ECA30288820CCE7 /* mdi.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = mdi.cpp; path = ../../src/osx/carbon/mdi.cpp; sourceTree = SOURCE_ROOT; }; 48F1439BF6C3361296F05A33 /* tif_error.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tif_error.c; path = ../../src/tiff/libtiff/tif_error.c; sourceTree = SOURCE_ROOT; }; 238741BDA2C73E56899CCB04 /* dcprint.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = dcprint.cpp; path = ../../src/osx/carbon/dcprint.cpp; sourceTree = SOURCE_ROOT; }; @@ -6349,7 +6345,6 @@ 552757A901E732CAA8E3F16D /* list.cpp */, EA93D41B11683E758D456531 /* log.cpp */, 72D7AF345E563587941BD868 /* longlong.cpp */, - 5466CC2D6579360E9C665EE5 /* memory.cpp */, 2F316F7DD3CB3390A6E50179 /* mimecmn.cpp */, 9DB43FAB1E563B02ACEFF647 /* module.cpp */, DC3D1E222FD93A69B1D1366E /* mstream.cpp */, @@ -7680,7 +7675,6 @@ 68AC8860B0943C1FAF76D96C /* list.cpp in Sources */, 3141FEDED0943BD6A2EF858F /* log.cpp in Sources */, 0C7E2D5C22A232368F862A61 /* longlong.cpp in Sources */, - DC978B60F6DF3176B5B114C5 /* memory.cpp in Sources */, B59FC7345C383D9099391AC5 /* mimecmn.cpp in Sources */, EC3A1C620D323B5590AABF03 /* module.cpp in Sources */, F38202271C6131908C358DEC /* mstream.cpp in Sources */, @@ -8403,7 +8397,6 @@ 68AC8860B0943C1FAF76D96B /* list.cpp in Sources */, 3141FEDED0943BD6A2EF8591 /* log.cpp in Sources */, 0C7E2D5C22A232368F862A60 /* longlong.cpp in Sources */, - DC978B60F6DF3176B5B114C3 /* memory.cpp in Sources */, B59FC7345C383D9099391AC4 /* mimecmn.cpp in Sources */, EC3A1C620D323B5590AABF02 /* module.cpp in Sources */, F38202271C6131908C358DEE /* mstream.cpp in Sources */, @@ -9726,7 +9719,6 @@ 68AC8860B0943C1FAF76D96D /* list.cpp in Sources */, 3141FEDED0943BD6A2EF8590 /* log.cpp in Sources */, 0C7E2D5C22A232368F862A62 /* longlong.cpp in Sources */, - DC978B60F6DF3176B5B114C4 /* memory.cpp in Sources */, B59FC7345C383D9099391AC3 /* mimecmn.cpp in Sources */, EC3A1C620D323B5590AABF04 /* module.cpp in Sources */, F38202271C6131908C358DED /* mstream.cpp in Sources */, diff --git a/build/osx/wxiphone.xcodeproj/project.pbxproj b/build/osx/wxiphone.xcodeproj/project.pbxproj index b3b52e00c0..1c8a63322a 100644 --- a/build/osx/wxiphone.xcodeproj/project.pbxproj +++ b/build/osx/wxiphone.xcodeproj/project.pbxproj @@ -145,7 +145,6 @@ 522E6CF2A62F34259BCE2DE2 /* tif_flush.c in Sources */ = {isa = PBXBuildFile; fileRef = 305614D19CF23CB2B14A5B2E /* tif_flush.c */; }; F016C51053373E658ED4C9A9 /* helpext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF376BC55EA73F5FB7328142 /* helpext.cpp */; }; D7F14BDFFB7F369B842AFC13 /* pcre2_config.c in Sources */ = {isa = PBXBuildFile; fileRef = FC6A8FAE9CA63EEB8883B6BD /* pcre2_config.c */; }; - DC978B60F6DF3176B5B114C3 /* memory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5466CC2D6579360E9C665EE5 /* memory.cpp */; }; BD49EC50CB363642BDBF25C8 /* mousemanager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D037EA567C253DEEA17E822B /* mousemanager.cpp */; }; 20F10669703137E68318C6FD /* cmndata.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0510EE0FB3FF36EF8670ABD1 /* cmndata.cpp */; }; 427E6AF88CF73D799206E37D /* checkboxcmn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4FC2F076657431458896115A /* checkboxcmn.cpp */; }; @@ -1569,7 +1568,6 @@ D7B3307E56B332769901E99F /* filehistorycmn.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = filehistorycmn.cpp; path = ../../src/common/filehistorycmn.cpp; sourceTree = SOURCE_ROOT; }; 21A697F65B1E31168F0A7BD7 /* xh_tree.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = xh_tree.cpp; path = ../../src/xrc/xh_tree.cpp; sourceTree = SOURCE_ROOT; }; 5BD6231188AB329CAA5E1171 /* evtloop_cf.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = evtloop_cf.cpp; path = ../../src/osx/core/evtloop_cf.cpp; sourceTree = SOURCE_ROOT; }; - 5466CC2D6579360E9C665EE5 /* memory.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = memory.cpp; path = ../../src/common/memory.cpp; sourceTree = SOURCE_ROOT; }; 994AF74DF2A13FF09A215853 /* intel_init.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = intel_init.c; path = ../../src/png/intel/intel_init.c; sourceTree = SOURCE_ROOT; }; 7395814D42CC38F6B8CD81B4 /* gzlib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = gzlib.c; path = ../../src/zlib/gzlib.c; sourceTree = SOURCE_ROOT; }; 9DB43FAB1E563B02ACEFF647 /* module.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = module.cpp; path = ../../src/common/module.cpp; sourceTree = SOURCE_ROOT; }; @@ -2139,7 +2137,6 @@ 552757A901E732CAA8E3F16D /* list.cpp */, EA93D41B11683E758D456531 /* log.cpp */, 72D7AF345E563587941BD868 /* longlong.cpp */, - 5466CC2D6579360E9C665EE5 /* memory.cpp */, 2F316F7DD3CB3390A6E50179 /* mimecmn.cpp */, 9DB43FAB1E563B02ACEFF647 /* module.cpp */, DC3D1E222FD93A69B1D1366E /* mstream.cpp */, @@ -3075,7 +3072,6 @@ 68AC8860B0943C1FAF76D96B /* list.cpp in Sources */, 3141FEDED0943BD6A2EF858F /* log.cpp in Sources */, 0C7E2D5C22A232368F862A60 /* longlong.cpp in Sources */, - DC978B60F6DF3176B5B114C3 /* memory.cpp in Sources */, B59FC7345C383D9099391AC3 /* mimecmn.cpp in Sources */, EC3A1C620D323B5590AABF02 /* module.cpp in Sources */, F38202271C6131908C358DEC /* mstream.cpp in Sources */, diff --git a/configure b/configure index 398ed09890..9c84f1fe27 100755 --- a/configure +++ b/configure @@ -673,7 +673,6 @@ COND_wxUSE_EXPAT_builtin COND_WXUNIV_1 COND_WITH_PLUGIN_SDL_1 COND_WINDOWS_IMPLIB_1 -COND_USE_XRC_1 COND_USE_XML_1 COND_USE_WEBVIEW_WEBKIT2_1 COND_USE_THREADS_1 @@ -1115,8 +1114,6 @@ enable_debug enable_debug_flag enable_debug_info enable_debug_gdb -enable_debug_cntxt -enable_mem_tracing enable_shared enable_cxx11 with_cxx @@ -2082,8 +2079,6 @@ Optional Features: --disable-debug_flag disable all debugging support --enable-debug_info generate debug information --enable-debug_gdb create code with extra GDB debugging information - --enable-debug_cntxt obsolete, don't use: use wxDebugContext - --enable-mem_tracing obsolete, don't use: create code with memory tracing --disable-shared create static library instead of shared --enable-cxx11 obsolete option doing nothing --enable-stl use standard C++ classes for everything @@ -5523,64 +5518,6 @@ fi eval "$wx_cv_use_debug_gdb" - enablestring= - defaultval= - if test -z "$defaultval"; then - if test x"$enablestring" = xdisable; then - defaultval=yes - else - defaultval=no - fi - fi - - # Check whether --enable-debug_cntxt was given. -if test "${enable_debug_cntxt+set}" = set; then : - enableval=$enable_debug_cntxt; - if test "$enableval" = yes; then - wx_cv_use_debug_cntxt='wxUSE_DEBUG_CONTEXT=yes' - else - wx_cv_use_debug_cntxt='wxUSE_DEBUG_CONTEXT=no' - fi - -else - - wx_cv_use_debug_cntxt='wxUSE_DEBUG_CONTEXT=${'DEFAULT_wxUSE_DEBUG_CONTEXT":-$defaultval}" - -fi - - - eval "$wx_cv_use_debug_cntxt" - - - enablestring= - defaultval= - if test -z "$defaultval"; then - if test x"$enablestring" = xdisable; then - defaultval=yes - else - defaultval=no - fi - fi - - # Check whether --enable-mem_tracing was given. -if test "${enable_mem_tracing+set}" = set; then : - enableval=$enable_mem_tracing; - if test "$enableval" = yes; then - wx_cv_use_mem_tracing='wxUSE_MEM_TRACING=yes' - else - wx_cv_use_mem_tracing='wxUSE_MEM_TRACING=no' - fi - -else - - wx_cv_use_mem_tracing='wxUSE_MEM_TRACING=${'DEFAULT_wxUSE_MEM_TRACING":-$defaultval}" - -fi - - - eval "$wx_cv_use_mem_tracing" - - enablestring=disable @@ -35635,15 +35572,6 @@ if test "$wxUSE_DEBUG_FLAG" = "no" ; then fi fi -if test "$wxUSE_MEM_TRACING" = "yes" ; then - $as_echo "#define wxUSE_MEMORY_TRACING 1" >>confdefs.h - - $as_echo "#define wxUSE_GLOBAL_MEMORY_OPERATORS 1" >>confdefs.h - - $as_echo "#define wxUSE_DEBUG_NEW_ALWAYS 1" >>confdefs.h - -fi - if test "$wxUSE_DMALLOC" = "yes" ; then DMALLOC_LIBS="-ldmallocthcxx" fi @@ -43251,11 +43179,6 @@ EOF COND_USE_XML_1="" fi - COND_USE_XRC_1="#" - if test "x$USE_XRC" = "x1" ; then - COND_USE_XRC_1="" - fi - COND_WINDOWS_IMPLIB_1="#" if test "x$WINDOWS_IMPLIB" = "x1" ; then COND_WINDOWS_IMPLIB_1="" diff --git a/configure.in b/configure.in index f06951dafd..515db606c5 100644 --- a/configure.in +++ b/configure.in @@ -647,8 +647,6 @@ dnl dnl in any case, only set the default value and allow overriding it with an WX_ARG_ENABLE(debug_gdb, [ --enable-debug_gdb create code with extra GDB debugging information], wxUSE_DEBUG_GDB) -WX_ARG_ENABLE(debug_cntxt, [ --enable-debug_cntxt obsolete, don't use: use wxDebugContext], wxUSE_DEBUG_CONTEXT) -WX_ARG_ENABLE(mem_tracing, [ --enable-mem_tracing obsolete, don't use: create code with memory tracing], wxUSE_MEM_TRACING) dnl --------------------------------------------------------------------------- dnl global compile options @@ -4797,12 +4795,6 @@ if test "$wxUSE_DEBUG_FLAG" = "no" ; then fi fi -if test "$wxUSE_MEM_TRACING" = "yes" ; then - AC_DEFINE(wxUSE_MEMORY_TRACING) - AC_DEFINE(wxUSE_GLOBAL_MEMORY_OPERATORS) - AC_DEFINE(wxUSE_DEBUG_NEW_ALWAYS) -fi - if test "$wxUSE_DMALLOC" = "yes" ; then DMALLOC_LIBS="-ldmallocthcxx" fi diff --git a/docs/changes.txt b/docs/changes.txt index 616fcaa008..4fb8c58d6f 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -86,6 +86,11 @@ Changes in behaviour which may result in build errors the official ones and those using MSVS projects, but also when using makefile.vc or CMake, for consistency. +- Support for memory debugging that was previously disabled but could be + activated by using wxUSE_MEMORY_TRACING, wxUSE_GLOBAL_MEMORY_OPERATORS etc + options was completely removed. Please use address sanitizer or similar + tools that are incomparably more useful for this than that legacy code. + 3.3.0: (released 2022-??-??) ---------------------------- diff --git a/docs/doxygen/mainpages/const_wxusedef.h b/docs/doxygen/mainpages/const_wxusedef.h index e53a5b3072..b26dd9b977 100644 --- a/docs/doxygen/mainpages/const_wxusedef.h +++ b/docs/doxygen/mainpages/const_wxusedef.h @@ -91,8 +91,6 @@ library: @itemdef{wxUSE_DATETIME, Use wxDateTime and related classes.} @itemdef{wxUSE_DBGHELP, Predefine as 0 to avoid using wxDbgHelpDLL and related classes.} @itemdef{wxUSE_DC_TRANSFORM_MATRIX, Use wxDC::SetTransformMatrix() and related methods.} -@itemdef{wxUSE_DEBUG_CONTEXT, Use wxDebugContext class.} -@itemdef{wxUSE_DEBUG_NEW_ALWAYS, See @ref overview_debugging} @itemdef{wxUSE_DEBUGREPORT, Use wxDebugReport class.} @itemdef{wxUSE_DIALUP_MANAGER, Use wxDialUpManager and related classes.} @itemdef{wxUSE_DIRDLG, Use wxDirDialog class.} @@ -130,7 +128,6 @@ library: @itemdef{wxUSE_GEOMETRY, Use common geometry classes} @itemdef{wxUSE_GIF, Use GIF wxImageHandler} @itemdef{wxUSE_GLCANVAS, Enables OpenGL support.} -@itemdef{wxUSE_GLOBAL_MEMORY_OPERATORS, Override global operators @c new and @c delete to use wxWidgets memory leak detection} @itemdef{wxUSE_GRAPHICS_CONTEXT, Use wxGraphicsContext and related classes.} @itemdef{wxUSE_GRID, Use wxGrid and related classes.} @itemdef{wxUSE_HELP, Use wxHelpController and related classes.} @@ -163,7 +160,6 @@ library: @itemdef{wxUSE_MDI, Use wxMDIParentFrame, and wxMDIChildFrame} @itemdef{wxUSE_MDI_ARCHITECTURE, Use MDI-based document-view classes.} @itemdef{wxUSE_MEDIACTRL, Use wxMediaCtrl.} -@itemdef{wxUSE_MEMORY_TRACING, Use wxWidgets memory leak detection, not recommended if using another memory debugging tool.} @itemdef{wxUSE_MENUS, Use wxMenu and wxMenuItem.} @itemdef{wxUSE_MENUBAR, Use wxMenubar.} @itemdef{wxUSE_METAFILE, Use wxMetaFile and related classes.} diff --git a/docs/x11/install.md b/docs/x11/install.md index e28eb919b4..a04fffe7d4 100644 --- a/docs/x11/install.md +++ b/docs/x11/install.md @@ -427,10 +427,6 @@ Troubleshooting {#x11_troubleshooting} argument functions, try putting the gcc fixinclude file paths early in the include path. -- If you operator-related compile errors or strange memory problems - (for example in deletion of string arrays), set wxUSE_GLOBAL_MEMORY_OPERATORS - and wxUSE_MEMORY_TRACING to 0 in setup.h, and recompile. - - If you get an internal compiler error in gcc, turn off optimisations. - Some compilers, such as Sun C++, may give a lot of warnings about diff --git a/include/wx/android/setup.h b/include/wx/android/setup.h index 3ffa9052d8..336f80fcbc 100644 --- a/include/wx/android/setup.h +++ b/include/wx/android/setup.h @@ -125,60 +125,6 @@ // is no overhead if you don't use it #define wxUSE_DEBUGREPORT 1 -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG -// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// The rest of the options in this section are obsolete and not supported, -// enable them at your own risk. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_CONTEXT 0 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for MinGW/Cygwin. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - // ---------------------------------------------------------------------------- // global features diff --git a/include/wx/defs.h b/include/wx/defs.h index 91d15ed1a0..488c8f70f9 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -850,13 +850,6 @@ typedef short int WXTYPE; /* compiler specific settings */ /* ---------------------------------------------------------------------------- */ -/* where should i put this? we need to make sure of this as it breaks */ -/* the code. */ -#if defined(__WXDEBUG__) -# undef wxUSE_DEBUG_NEW_ALWAYS -# define wxUSE_DEBUG_NEW_ALWAYS 0 -#endif - #include "wx/types.h" #ifdef __cplusplus diff --git a/include/wx/event.h b/include/wx/event.h index e1ad32613b..b655d64adf 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -3583,12 +3583,6 @@ public: // Clear table void Clear(); -#if wxUSE_MEMORY_TRACING - // Clear all tables: only used to work around problems in memory tracing - // code - static void ClearAll(); -#endif // wxUSE_MEMORY_TRACING - protected: // Init the hash table with the entries of the static event table. void InitHashTable(); diff --git a/include/wx/gtk/setup.h b/include/wx/gtk/setup.h index 7ddb69cca3..210944074a 100644 --- a/include/wx/gtk/setup.h +++ b/include/wx/gtk/setup.h @@ -126,60 +126,6 @@ // is no overhead if you don't use it #define wxUSE_DEBUGREPORT 1 -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG -// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// The rest of the options in this section are obsolete and not supported, -// enable them at your own risk. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_CONTEXT 0 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for MinGW/Cygwin. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - // ---------------------------------------------------------------------------- // global features diff --git a/include/wx/memory.h b/include/wx/memory.h index d010e8b013..fb9dd49d8a 100644 --- a/include/wx/memory.h +++ b/include/wx/memory.h @@ -1,6 +1,8 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/memory.h -// Purpose: Memory operations +// Purpose: Obsolete legacy header for memory debugging: don't include it +// it any longer, it is only preserved to avoid breaking existing +// code including it. // Author: Arthur Seaton, Julian Smart // Modified by: // Created: 29/01/98 @@ -11,339 +13,8 @@ #ifndef _WX_MEMORY_H_ #define _WX_MEMORY_H_ -#include "wx/defs.h" -#include "wx/string.h" -#include "wx/msgout.h" - -#if wxUSE_MEMORY_TRACING || wxUSE_DEBUG_CONTEXT - -#include - -WXDLLIMPEXP_BASE void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool isVect = false); -WXDLLIMPEXP_BASE void wxDebugFree(void * buf, bool isVect = false); - -//********************************************************************************** -/* - The global operator new used for everything apart from getting - dynamic storage within this function itself. -*/ - -// We'll only do malloc and free for the moment: leave the interesting -// stuff for the wxObject versions. - - -#if wxUSE_GLOBAL_MEMORY_OPERATORS - -// Undefine temporarily (new is #defined in object.h) because we want to -// declare some new operators. -#ifdef new - #undef new -#endif - -#if defined(__SUNCC__) - #define wxUSE_ARRAY_MEMORY_OPERATORS 0 -#elif defined (__SGI_CC_) - // only supported by -n32 compilers - #ifndef __EDG_ABI_COMPATIBILITY_VERSION - #define wxUSE_ARRAY_MEMORY_OPERATORS 0 - #endif -#else - #define wxUSE_ARRAY_MEMORY_OPERATORS 1 -#endif - -// devik 2000-8-29: All new/delete ops are now inline because they can't -// be marked as dllexport/dllimport. It then leads to weird bugs when -// used on MSW as DLL -#if defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) -inline void * operator new (size_t size, wxChar * fileName, int lineNum) -{ - return wxDebugAlloc(size, fileName, lineNum, false, false); -} - -inline void * operator new (size_t size) -{ - return wxDebugAlloc(size, nullptr, 0, false); -} - -inline void operator delete (void * buf) -{ - wxDebugFree(buf, false); -} - -#if wxUSE_ARRAY_MEMORY_OPERATORS -inline void * operator new[] (size_t size) -{ - return wxDebugAlloc(size, nullptr, 0, false, true); -} - -inline void * operator new[] (size_t size, wxChar * fileName, int lineNum) -{ - return wxDebugAlloc(size, fileName, lineNum, false, true); -} - -inline void operator delete[] (void * buf) -{ - wxDebugFree(buf, true); -} -#endif // wxUSE_ARRAY_MEMORY_OPERATORS - -#else - -void * operator new (size_t size, wxChar * fileName, int lineNum); - -void * operator new (size_t size); - -void operator delete (void * buf); - -#if wxUSE_ARRAY_MEMORY_OPERATORS -void * operator new[] (size_t size); - -void * operator new[] (size_t size, wxChar * fileName, int lineNum); - -void operator delete[] (void * buf); -#endif // wxUSE_ARRAY_MEMORY_OPERATORS -#endif // defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) - -#if defined(__VISUALC__) -inline void operator delete(void* pData, wxChar* /* fileName */, int /* lineNum */) -{ - wxDebugFree(pData, false); -} -inline void operator delete[](void* pData, wxChar* /* fileName */, int /* lineNum */) -{ - wxDebugFree(pData, true); -} -#endif // __VISUALC__ -#endif // wxUSE_GLOBAL_MEMORY_OPERATORS - -//********************************************************************************** - -typedef unsigned int wxMarkerType; - -/* - Define the struct which will be placed at the start of all dynamically - allocated memory. -*/ - -class WXDLLIMPEXP_BASE wxMemStruct { - -friend class WXDLLIMPEXP_FWD_BASE wxDebugContext; // access to the m_next pointer for list traversal. - -public: -public: - int AssertList (); - - size_t RequestSize () { return m_reqSize; } - wxMarkerType Marker () { return m_firstMarker; } - - // When an object is deleted we set the id slot to a specific value. - inline void SetDeleted (); - inline int IsDeleted (); - - int Append (); - int Unlink (); - - // Used to determine if the object is really a wxMemStruct. - // Not a foolproof test by any means, but better than none I hope! - int AssertIt (); - - // Do all validation on a node. - int ValidateNode (); - - // Check the integrity of a node and of the list, node by node. - int CheckBlock (); - int CheckAllPrevious (); - - // Print a single node. - void PrintNode (); - - // Called when the memory linking functions get an error. - void ErrorMsg (const char *); - void ErrorMsg (); - - inline void *GetActualData(void) const { return m_actualData; } - - void Dump(void); - -public: - // Check for underwriting. There are 2 of these checks. This one - // inside the struct and another right after the struct. - wxMarkerType m_firstMarker; - - // File name and line number are from cpp. - wxChar* m_fileName; - int m_lineNum; - - // The amount of memory requested by the caller. - size_t m_reqSize; - - // Used to try to verify that we really are dealing with an object - // of the required class. Can be 1 of 2 values these indicating a valid - // wxMemStruct object, or a deleted wxMemStruct object. - wxMarkerType m_id; - - wxMemStruct * m_prev; - wxMemStruct * m_next; - - void * m_actualData; - bool m_isObject; -}; - - -typedef void (wxMemStruct::*PmSFV) (); - -// Type of the app function that can be installed and called at wxWidgets shutdown -// (after all other registered files with global destructors have been closed down). -typedef void (*wxShutdownNotifyFunction)(); - -/* - Debugging class. This will only have a single instance, but it's - a reasonable way to keep everything together and to make this - available for change if needed by someone else. - A lot of this stuff would be better off within the wxMemStruct class, but - it's stuff which we need to access at times when there is no wxMemStruct - object so we use this class instead. Think of it as a collection of - globals which have to do with the wxMemStruct class. -*/ - -class WXDLLIMPEXP_BASE wxDebugContext { - -protected: - // Used to set alignment for markers. - static size_t CalcAlignment (); - - // Returns the amount of padding needed after something of the given - // size. This is so that when we cast pointers backwards and forwards - // the pointer value will be valid for a wxMarkerType. - static size_t GetPadding (size_t size) ; - - // Traverse the list. - static void TraverseList (PmSFV, wxMemStruct *from = nullptr); - - static int debugLevel; - static bool debugOn; - - static int m_balign; // byte alignment - static int m_balignmask; // mask for performing byte alignment -public: - // Set a checkpoint to dump only the memory from - // a given point - static wxMemStruct *checkPoint; - - wxDebugContext(void); - ~wxDebugContext(void); - - static int GetLevel(void) { return debugLevel; } - static void SetLevel(int level) { debugLevel = level; } - - static bool GetDebugMode(void) { return debugOn; } - static void SetDebugMode(bool flag) { debugOn = flag; } - - static void SetCheckpoint(bool all = false); - static wxMemStruct *GetCheckpoint(void) { return checkPoint; } - - // Calculated from the request size and any padding needed - // before the final marker. - static size_t PaddedSize (size_t reqSize); - - // Calc the total amount of space we need from the system - // to satisfy a caller request. This includes all padding. - static size_t TotSize (size_t reqSize); - - // Return valid pointers to offsets within the allocated memory. - static char * StructPos (const char * buf); - static char * MidMarkerPos (const char * buf); - static char * CallerMemPos (const char * buf); - static char * EndMarkerPos (const char * buf, size_t size); - - // Given a pointer to the start of the caller requested area - // return a pointer to the start of the entire alloc\'d buffer. - static char * StartPos (const char * caller); - - // Access to the list. - static wxMemStruct * GetHead () { return m_head; } - static wxMemStruct * GetTail () { return m_tail; } - - // Set the list sentinels. - static wxMemStruct * SetHead (wxMemStruct * st) { return (m_head = st); } - static wxMemStruct * SetTail (wxMemStruct * st) { return (m_tail = st); } - - // If this is set then every new operation checks the validity - // of the all previous nodes in the list. - static bool GetCheckPrevious () { return m_checkPrevious; } - static void SetCheckPrevious (bool value) { m_checkPrevious = value; } - - // Checks all nodes, or all nodes if checkAll is true - static int Check(bool checkAll = false); - - // Print out the list of wxMemStruct nodes. - static bool PrintList(void); - - // Dump objects - static bool Dump(void); - - // Print statistics - static bool PrintStatistics(bool detailed = true); - - // Print out the classes in the application. - static bool PrintClasses(void); - - // Count the number of non-wxDebugContext-related objects - // that are outstanding - static int CountObjectsLeft(bool sinceCheckpoint = false); - - // This function is used to output the dump - static void OutputDumpLine(const wxChar *szFormat, ...); - - static void SetShutdownNotifyFunction(wxShutdownNotifyFunction shutdownFn); - -private: - // Store these here to allow access to the list without - // needing to have a wxMemStruct object. - static wxMemStruct* m_head; - static wxMemStruct* m_tail; - - // Set to false if we're not checking all previous nodes when - // we do a new. Set to true when we are. - static bool m_checkPrevious; - - // Holds a pointer to an optional application function to call at shutdown. - static wxShutdownNotifyFunction sm_shutdownFn; - - // Have to access our shutdown hook - friend class wxDebugContextDumpDelayCounter; -}; - -// Final cleanup (e.g. deleting the log object and doing memory leak checking) -// will be delayed until all wxDebugContextDumpDelayCounter objects have been -// destructed. Adding one wxDebugContextDumpDelayCounter per file will delay -// memory leak checking until after destructing all global objects. - -class WXDLLIMPEXP_BASE wxDebugContextDumpDelayCounter -{ -public: - wxDebugContextDumpDelayCounter(); - ~wxDebugContextDumpDelayCounter(); - -private: - void DoDump(); - static int sm_count; -}; - -// make leak dump after all globals have been destructed -static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_File; -#define WXDEBUG_DUMPDELAYCOUNTER \ - static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_Extra; - -// Output a debug message, in a system dependent fashion. -void WXDLLIMPEXP_BASE wxTrace(const wxChar *fmt ...) WX_ATTRIBUTE_PRINTF_1; -void WXDLLIMPEXP_BASE wxTraceLevel(int level, const wxChar *fmt ...) WX_ATTRIBUTE_PRINTF_2; - -#define WXTRACE wxTrace -#define WXTRACELEVEL wxTraceLevel - -#else // wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT - +// These obsolete macros are still defined just in case anybody is using them, +// but nobody should. #define WXDEBUG_DUMPDELAYCOUNTER #define wxTrace(fmt) @@ -352,6 +23,4 @@ void WXDLLIMPEXP_BASE wxTraceLevel(int level, const wxChar *fmt ...) WX_ATTRIBUT #define WXTRACE true ? (void)0 : wxTrace #define WXTRACELEVEL true ? (void)0 : wxTraceLevel -#endif // wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT - #endif // _WX_MEMORY_H_ diff --git a/include/wx/msw/chkconf.h b/include/wx/msw/chkconf.h index 0bf4a24c5e..d130da9993 100644 --- a/include/wx/msw/chkconf.h +++ b/include/wx/msw/chkconf.h @@ -149,19 +149,6 @@ # define wxUSE_CRASHREPORT 0 #endif /* compiler doesn't support SEH */ -#if defined(__GNUWIN32__) - /* These don't work as expected for mingw32 and cygwin32 */ -# undef wxUSE_MEMORY_TRACING -# define wxUSE_MEMORY_TRACING 0 - -# undef wxUSE_GLOBAL_MEMORY_OPERATORS -# define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -# undef wxUSE_DEBUG_NEW_ALWAYS -# define wxUSE_DEBUG_NEW_ALWAYS 0 - -#endif /* __GNUWIN32__ */ - /* MinGW32 doesn't provide wincred.h defining the API needed by this */ #ifdef __MINGW32_TOOLCHAIN__ #undef wxUSE_SECRETSTORE diff --git a/include/wx/msw/msvcrt.h b/include/wx/msw/msvcrt.h index 3411bcc7e7..e8b6563482 100644 --- a/include/wx/msw/msvcrt.h +++ b/include/wx/msw/msvcrt.h @@ -22,11 +22,8 @@ // use debug CRT functions for memory leak detections in VC++ 5.0+ in debug // builds #undef wxUSE_VC_CRTDBG -#if defined(_DEBUG) && defined(__VISUALC__) - // it doesn't combine well with wxWin own memory debugging methods - #if !wxUSE_GLOBAL_MEMORY_OPERATORS && !wxUSE_MEMORY_TRACING && !defined(__NO_VC_CRTDBG__) - #define wxUSE_VC_CRTDBG - #endif +#if defined(_DEBUG) && defined(__VISUALC__) && !defined(__NO_VC_CRTDBG__) + #define wxUSE_VC_CRTDBG #endif #ifdef wxUSE_VC_CRTDBG diff --git a/include/wx/msw/setup.h b/include/wx/msw/setup.h index 3a194644c5..d72f9de5d8 100644 --- a/include/wx/msw/setup.h +++ b/include/wx/msw/setup.h @@ -126,60 +126,6 @@ // is no overhead if you don't use it #define wxUSE_DEBUGREPORT 1 -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG -// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// The rest of the options in this section are obsolete and not supported, -// enable them at your own risk. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_CONTEXT 0 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for MinGW/Cygwin. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - // ---------------------------------------------------------------------------- // global features diff --git a/include/wx/object.h b/include/wx/object.h index a3c2b770d5..bda5386e8a 100644 --- a/include/wx/object.h +++ b/include/wx/object.h @@ -16,7 +16,12 @@ // headers // ---------------------------------------------------------------------------- -#include "wx/memory.h" +// This really shouldn't be done here, but keep including this header for +// compatibility as it used to be included from here in the previous versions +// of wx and a lot of code would be broken by removing it. +#ifndef WXBUILDING + #include "wx/string.h" +#endif #define wxDECLARE_CLASS_INFO_ITERATORS() \ class WXDLLIMPEXP_BASE const_iterator \ @@ -161,47 +166,6 @@ inline T *wxCheckCast(const void *ptr) #define wxStaticCast(obj, className) wxCheckCast(obj) -// ---------------------------------------------------------------------------- -// set up memory debugging macros -// ---------------------------------------------------------------------------- - -/* - Which new/delete operator variants do we want? - - _WX_WANT_NEW_SIZET_WXCHAR_INT = void *operator new (size_t size, wxChar *fileName = 0, int lineNum = 0) - _WX_WANT_DELETE_VOID = void operator delete (void * buf) - _WX_WANT_DELETE_VOID_WXCHAR_INT = void operator delete(void *buf, wxChar*, int) - _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT = void *operator new[] (size_t size, wxChar *fileName , int lineNum = 0) - _WX_WANT_ARRAY_DELETE_VOID = void operator delete[] (void *buf) - _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT = void operator delete[] (void* buf, wxChar*, int ) -*/ - -#if wxUSE_MEMORY_TRACING - -// All compilers get these ones -#define _WX_WANT_NEW_SIZET_WXCHAR_INT -#define _WX_WANT_DELETE_VOID - -#if defined(__VISUALC__) - #define _WX_WANT_DELETE_VOID_WXCHAR_INT -#endif - -// Now see who (if anyone) gets the array memory operators -#if wxUSE_ARRAY_MEMORY_OPERATORS - - // Everyone except Visual C++ (cause problems for VC++ - crashes) - #if !defined(__VISUALC__) - #define _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT - #endif - - // Everyone except Visual C++ (cause problems for VC++ - crashes) - #if !defined(__VISUALC__) - #define _WX_WANT_ARRAY_DELETE_VOID - #endif -#endif // wxUSE_ARRAY_MEMORY_OPERATORS - -#endif // wxUSE_MEMORY_TRACING - // ---------------------------------------------------------------------------- // Compatibility macro aliases DECLARE group // ---------------------------------------------------------------------------- @@ -476,22 +440,6 @@ inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo) #include "wx/xti2.h" -// ---------------------------------------------------------------------------- -// more debugging macros -// ---------------------------------------------------------------------------- - -#if wxUSE_DEBUG_NEW_ALWAYS - #define WXDEBUG_NEW new(__TFILE__,__LINE__) - - #if wxUSE_GLOBAL_MEMORY_OPERATORS - #define new WXDEBUG_NEW - #elif defined(__VISUALC__) - // Including this file redefines new and allows leak reports to - // contain line numbers - #include "wx/msw/msvcrt.h" - #endif -#endif // wxUSE_DEBUG_NEW_ALWAYS - // ---------------------------------------------------------------------------- // Compatibility macro aliases IMPLEMENT group // ---------------------------------------------------------------------------- diff --git a/include/wx/osx/setup.h b/include/wx/osx/setup.h index 711cccf88e..9be31964d4 100644 --- a/include/wx/osx/setup.h +++ b/include/wx/osx/setup.h @@ -132,60 +132,6 @@ // is no overhead if you don't use it #define wxUSE_DEBUGREPORT 1 -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG -// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// The rest of the options in this section are obsolete and not supported, -// enable them at your own risk. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_CONTEXT 0 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for MinGW/Cygwin. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - // ---------------------------------------------------------------------------- // global features diff --git a/include/wx/rtti.h b/include/wx/rtti.h index e04a39f67c..d14c7e8570 100644 --- a/include/wx/rtti.h +++ b/include/wx/rtti.h @@ -14,12 +14,6 @@ #if !wxUSE_EXTENDED_RTTI // XTI system is meant to replace these macros -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/memory.h" - // ---------------------------------------------------------------------------- // forward declarations // ---------------------------------------------------------------------------- diff --git a/include/wx/setup_inc.h b/include/wx/setup_inc.h index 5bb0b5c1c1..b5515be609 100644 --- a/include/wx/setup_inc.h +++ b/include/wx/setup_inc.h @@ -122,60 +122,6 @@ // is no overhead if you don't use it #define wxUSE_DEBUGREPORT 1 -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG -// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// The rest of the options in this section are obsolete and not supported, -// enable them at your own risk. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_CONTEXT 0 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for MinGW/Cygwin. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - // ---------------------------------------------------------------------------- // global features diff --git a/include/wx/univ/setup.h b/include/wx/univ/setup.h index a568567169..e04243c292 100644 --- a/include/wx/univ/setup.h +++ b/include/wx/univ/setup.h @@ -125,60 +125,6 @@ // is no overhead if you don't use it #define wxUSE_DEBUGREPORT 1 -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG -// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// The rest of the options in this section are obsolete and not supported, -// enable them at your own risk. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_CONTEXT 0 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for MinGW/Cygwin. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - // ---------------------------------------------------------------------------- // global features diff --git a/include/wx/wx.h b/include/wx/wx.h index f672167d60..6570a266da 100644 --- a/include/wx/wx.h +++ b/include/wx/wx.h @@ -25,7 +25,6 @@ #include "wx/app.h" #include "wx/utils.h" #include "wx/stream.h" -#include "wx/memory.h" #include "wx/math.h" #include "wx/stopwatch.h" #include "wx/timer.h" diff --git a/interface/wx/memory.h b/interface/wx/memory.h deleted file mode 100644 index 989c30ddae..0000000000 --- a/interface/wx/memory.h +++ /dev/null @@ -1,223 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: memory.h -// Purpose: interface of wxDebugContext -// Author: wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - - -/** - @class wxDebugContext - - A class for performing various debugging and memory tracing operations. - - Full functionality (such as printing out objects currently allocated) is - only present in a debugging build of wxWidgets, i.e. if the @c \__WXDEBUG__ - symbol is defined. wxDebugContext and related functions and macros can be - compiled out by setting wxUSE_DEBUG_CONTEXT to 0 is setup.h - - @library{wxbase} - @category{debugging} - - @see @ref overview_debugging -*/ -class wxDebugContext -{ -public: - /** - Checks the memory blocks for errors, starting from the currently set - checkpoint. - - @return Returns the number of errors, so a value of zero represents - success. Returns -1 if an error was detected that prevents - further checking. - */ - static int Check(bool checkAll = false); - - /** - Performs a memory dump from the currently set checkpoint, writing to the - current debug stream. Calls the @b Dump member function for each wxObject - derived instance. - - @return @true if the function succeeded, @false otherwise. - */ - static bool Dump(); - - /** - Returns @true if the memory allocator checks all previous memory blocks for - errors. - - By default, this is @false since it slows down execution considerably. - - @see SetCheckPrevious() - */ - static bool GetCheckPrevious(); - - /** - Returns @true if debug mode is on. - - If debug mode is on, the wxObject new and delete operators store or use - information about memory allocation. Otherwise, a straight malloc and - free will be performed by these operators. - - @see SetDebugMode() - */ - static bool GetDebugMode(); - - /** - Gets the debug level (default 1). - - The debug level is used by the wxTraceLevel function and the WXTRACELEVEL - macro to specify how detailed the trace information is; setting a - different level will only have an effect if trace statements in the - application specify a value other than one. - - @deprecated - This is obsolete, replaced by wxLog functionality. - - @see SetLevel() - */ - static int GetLevel(); - - /** - Prints a list of the classes declared in this application, giving derivation - and whether instances of this class can be dynamically created. - - @see PrintStatistics() - */ - static bool PrintClasses(); - - /** - Performs a statistics analysis from the currently set checkpoint, writing - to the current debug stream. The number of object and non-object - allocations is printed, together with the total size. - - @param detailed - If @true, the function will also print how many objects of each class - have been allocated, and the space taken by these class instances. - - @see PrintStatistics() - */ - static bool PrintStatistics(bool detailed = true); - - /** - Tells the memory allocator to check all previous memory blocks for errors. - By default, this is @false since it slows down execution considerably. - - @see GetCheckPrevious() - */ - static void SetCheckPrevious(bool check); - - /** - Sets the current checkpoint: Dump and PrintStatistics operations will - be performed from this point on. This allows you to ignore allocations - that have been performed up to this point. - - @param all - If @true, the checkpoint is reset to include all memory allocations - since the program started. - */ - static void SetCheckpoint(bool all = false); - - /** - Sets the debug mode on or off. - - If debug mode is on, the wxObject new and delete operators store or use - information about memory allocation. Otherwise, a straight malloc and free - will be performed by these operators. - - By default, debug mode is on if @c \__WXDEBUG__ is defined. If the application - uses this function, it should make sure that all object memory allocated - is deallocated with the same value of debug mode. Otherwise, the delete - operator might try to look for memory information that does not exist. - - @see GetDebugMode() - */ - static void SetDebugMode(bool debug); - - /** - Sets the debug level (default 1). - - The debug level is used by the wxTraceLevel function and the WXTRACELEVEL - macro to specify how detailed the trace information is; setting - a different level will only have an effect if trace statements in the - application specify a value other than one. - - @deprecated - This is obsolete, replaced by wxLog functionality. - - @see GetLevel() - */ - static void SetLevel(int level); - - /** - Installs a function to be called at the end of wxWidgets shutdown. - It will be called after all files with global instances of - wxDebugContextDumpDelayCounter have run their destructors. - - The shutdown function must be take no parameters and return nothing. - */ - static void SetShutdownNotifyFunction(wxShutdownNotifyFunction func); -}; - - - -// ============================================================================ -// Global functions/macros -// ============================================================================ - -/** @addtogroup group_funcmacro_log */ -///@{ - -/** - @deprecated Use one of the wxLogTrace() functions or one of the - wxVLogTrace() functions instead. - - Calls wxTrace() with printf-style variable argument syntax. Output is - directed to the current output stream (see wxDebugContext). - - @header{wx/memory.h} -*/ -#define WXTRACE(format, ...) - -/** - @deprecated Use one of the wxLogTrace() functions or one of the - wxVLogTrace() functions instead. - - Calls wxTraceLevel with printf-style variable argument syntax. Output is - directed to the current output stream (see wxDebugContext). The first - argument should be the level at which this information is appropriate. It - will only be output if the level returned by wxDebugContext::GetLevel is - equal to or greater than this value. - - @header{wx/memory.h} -*/ -#define WXTRACELEVEL(level, format, ...) - -/** - @deprecated Use one of the wxLogTrace() functions or one of the - wxVLogTrace() functions instead. - - Takes printf-style variable argument syntax. Output is directed to the - current output stream (see wxDebugContext). - - @header{wx/memory.h} -*/ -void wxTrace(const wxString& format, ...); - -/** - @deprecated Use one of the wxLogTrace() functions or one of the - wxVLogTrace() functions instead. - - Takes @e printf() style variable argument syntax. Output is directed to the - current output stream (see wxDebugContext). The first argument should be - the level at which this information is appropriate. It will only be output - if the level returned by wxDebugContext::GetLevel() is equal to or greater - than this value. - - @header{wx/memory.h} -*/ -void wxTraceLevel(int level, const wxString& format, ...); - -///@} - diff --git a/samples/propgrid/propgrid.cpp b/samples/propgrid/propgrid.cpp index 8993fbd6b5..8898f9afa4 100644 --- a/samples/propgrid/propgrid.cpp +++ b/samples/propgrid/propgrid.cpp @@ -1669,10 +1669,8 @@ void FormMain::PopulateWithLibraryConfig () #endif ADD_WX_LIB_CONF_GROUP("Debugging Settings") - ADD_WX_LIB_CONF( wxUSE_DEBUG_CONTEXT ) - ADD_WX_LIB_CONF( wxUSE_MEMORY_TRACING ) - ADD_WX_LIB_CONF( wxUSE_GLOBAL_MEMORY_OPERATORS ) - ADD_WX_LIB_CONF( wxUSE_DEBUG_NEW_ALWAYS ) + ADD_WX_LIB_CONF( wxUSE_DEBUGREPORT ) + ADD_WX_LIB_CONF( wxUSE_STACKWALKER ) ADD_WX_LIB_CONF( wxUSE_ON_FATAL_EXCEPTION ) ADD_WX_LIB_CONF_GROUP("Unicode Support") diff --git a/setup.h.in b/setup.h.in index 8cd3dcf198..e015fcd181 100644 --- a/setup.h.in +++ b/setup.h.in @@ -141,16 +141,6 @@ -#define wxUSE_DEBUG_CONTEXT 0 - -#define wxUSE_MEMORY_TRACING 0 - -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -#define wxUSE_DEBUG_NEW_ALWAYS 0 - - - #define wxUSE_EXCEPTIONS 0 #define wxUSE_EXTENDED_RTTI 0 diff --git a/setup.h_vms b/setup.h_vms index 4dc86832fc..f2c5ef822d 100644 --- a/setup.h_vms +++ b/setup.h_vms @@ -169,16 +169,8 @@ typedef pid_t GPid; #define wxDIALOG_UNIT_COMPATIBILITY 1 -#define wxUSE_DEBUG_CONTEXT 1 - #define wxUSE_DEBUGREPORT 1 -#define wxUSE_MEMORY_TRACING 0 - -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -#define wxUSE_DEBUG_NEW_ALWAYS 1 - #define wxUSE_ON_FATAL_EXCEPTION 1 #define wxUSE_STACKWALKER 0 diff --git a/src/common/descrip.mms b/src/common/descrip.mms index 83c901164f..24380935e9 100644 --- a/src/common/descrip.mms +++ b/src/common/descrip.mms @@ -143,7 +143,6 @@ OBJECTS1=fs_inet.obj,\ list.obj,\ log.obj,\ longlong.obj,\ - memory.obj,\ menucmn.obj,\ mimecmn.obj,\ module.obj,\ @@ -336,7 +335,6 @@ SOURCES = \ listctrlcmn.cpp,\ log.cpp,\ longlong.cpp,\ - memory.cpp,\ menucmn.cpp,\ mimecmn.cpp,\ module.cpp,\ @@ -576,7 +574,6 @@ lboxcmn.obj : lboxcmn.cpp list.obj : list.cpp log.obj : log.cpp longlong.obj : longlong.cpp -memory.obj : memory.cpp menucmn.obj : menucmn.cpp mimecmn.obj : mimecmn.cpp module.obj : module.cpp diff --git a/src/common/event.cpp b/src/common/event.cpp index 818a19c0de..e17b8553cf 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -131,27 +131,6 @@ const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { wxDECLARE_EVENT_TABLE_TERMINATOR() }; -// wxUSE_MEMORY_TRACING considers memory freed from the static objects dtors -// leaked, so we need to manually clean up all event tables before checking for -// the memory leaks when using it, however this breaks re-initializing the -// library (i.e. repeated calls to wxInitialize/wxUninitialize) because the -// event tables won't be rebuilt the next time, so disable this by default -#if wxUSE_MEMORY_TRACING - -class wxEventTableEntryModule: public wxModule -{ -public: - wxEventTableEntryModule() { } - virtual bool OnInit() override { return true; } - virtual void OnExit() override { wxEventHashTable::ClearAll(); } - - wxDECLARE_DYNAMIC_CLASS(wxEventTableEntryModule); -}; - -wxIMPLEMENT_DYNAMIC_CLASS(wxEventTableEntryModule, wxModule); - -#endif // wxUSE_MEMORY_TRACING - // ---------------------------------------------------------------------------- // global variables // ---------------------------------------------------------------------------- @@ -994,21 +973,6 @@ void wxEventHashTable::Clear() m_size = 0; } -#if wxUSE_MEMORY_TRACING - -// Clear all tables -void wxEventHashTable::ClearAll() -{ - wxEventHashTable* table = sm_first; - while (table) - { - table->Clear(); - table = table->m_next; - } -} - -#endif // wxUSE_MEMORY_TRACING - bool wxEventHashTable::HandleEvent(wxEvent &event, wxEvtHandler *self) { if (m_rebuildHash) diff --git a/src/common/memory.cpp b/src/common/memory.cpp deleted file mode 100644 index 7f40322d58..0000000000 --- a/src/common/memory.cpp +++ /dev/null @@ -1,1141 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/common/memory.cpp -// Purpose: Memory checking implementation -// Author: Arthur Seaton, Julian Smart -// Modified by: -// Created: 04/01/98 -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - - -#if wxUSE_MEMORY_TRACING || wxUSE_DEBUG_CONTEXT - -#include "wx/memory.h" - -#ifndef WX_PRECOMP - #ifdef __WINDOWS__ - #include "wx/msw/wrapwin.h" - #endif - #include "wx/utils.h" - #include "wx/app.h" - #include "wx/hash.h" - #include "wx/log.h" - #include "wx/wxcrtvararg.h" // for wxVsnprintf -#endif - -#if wxUSE_THREADS - #include "wx/thread.h" -#endif - -#include - -#include "wx/ioswrap.h" - -#if !(defined(__VMS__) && ( __VMS_VER < 70000000 ) ) -#include -#endif - -#include -#include - -#if wxUSE_THREADS -#define USE_THREADSAFE_MEMORY_ALLOCATION 1 -#else -#define USE_THREADSAFE_MEMORY_ALLOCATION 0 -#endif - - -#ifdef new -#undef new -#endif - -// wxDebugContext wxTheDebugContext; -/* - Redefine new and delete so that we can pick up situations where: - - we overwrite or underwrite areas of malloc'd memory. - - we use uninitialise variables - Only do this in debug mode. - - We change new to get enough memory to allocate a struct, followed - by the caller's requested memory, followed by a tag. The struct - is used to create a doubly linked list of these areas and also - contains another tag. The tags are used to determine when the area - has been over/under written. -*/ - - -/* - Values which are used to set the markers which will be tested for - under/over write. There are 3 of these, one in the struct, one - immediately after the struct but before the caller requested memory and - one immediately after the requested memory. -*/ -#define MemStartCheck 0x23A8 -#define MemMidCheck 0xA328 -#define MemEndCheck 0x8A32 -#define MemFillChar 0xAF -#define MemStructId 0x666D - -/* - External interface for the wxMemStruct class. Others are - defined inline within the class def. Here we only need to be able - to add and delete nodes from the list and handle errors in some way. -*/ - -/* - Used for internal "this shouldn't happen" type of errors. -*/ -void wxMemStruct::ErrorMsg (const char * mesg) -{ - wxLogMessage(wxT("wxWidgets memory checking error: %s"), mesg); - PrintNode (); -} - -/* - Used when we find an overwrite or an underwrite error. -*/ -void wxMemStruct::ErrorMsg () -{ - wxLogMessage(wxT("wxWidgets over/underwrite memory error:")); - PrintNode (); -} - - -/* - We want to find out if pointers have been overwritten as soon as is - possible, so test everything before we dereference it. Of course it's still - quite possible that, if things have been overwritten, this function will - fall over, but the only way of dealing with that would cost too much in terms - of time. -*/ -int wxMemStruct::AssertList () -{ - if ((wxDebugContext::GetHead() && !wxDebugContext::GetHead()->AssertIt()) || - (wxDebugContext::GetTail() && !wxDebugContext::GetTail()->AssertIt())) - { - ErrorMsg ("Head or tail pointers trashed"); - return 0; - } - return 1; -} - - -/* - Check that the thing we're pointing to has the correct id for a wxMemStruct - object and also that it's previous and next pointers are pointing at objects - which have valid ids. - This is definitely not perfect since we could fall over just trying to access - any of the slots which we use here, but I think it's about the best that I - can do without doing something like taking all new wxMemStruct pointers and - comparing them against all known pointer within the list and then only - doing this sort of check _after_ you've found the pointer in the list. That - would be safer, but also much more time consuming. -*/ -int wxMemStruct::AssertIt () -{ - return (m_id == MemStructId && - (m_prev == 0 || m_prev->m_id == MemStructId) && - (m_next == 0 || m_next->m_id == MemStructId)); -} - - -/* - Additions are always at the tail of the list. - Returns 0 on error, non-zero on success. -*/ -int wxMemStruct::Append () -{ - if (! AssertList ()) - return 0; - - if (wxDebugContext::GetHead () == 0) { - if (wxDebugContext::GetTail () != 0) { - ErrorMsg ("Null list should have a null tail pointer"); - return 0; - } - (void) wxDebugContext::SetHead (this); - (void) wxDebugContext::SetTail (this); - } else { - wxDebugContext::GetTail ()->m_next = this; - this->m_prev = wxDebugContext::GetTail (); - (void) wxDebugContext::SetTail (this); - } - return 1; -} - - -/* - Don't actually free up anything here as the space which is used - by the node will be free'd up when the whole block is free'd. - Returns 0 on error, non-zero on success. -*/ -int wxMemStruct::Unlink () -{ - if (! AssertList ()) - return 0; - - if (wxDebugContext::GetHead () == 0 || wxDebugContext::GetTail () == 0) { - ErrorMsg ("Trying to remove node from empty list"); - return 0; - } - - // Handle the part of the list before this node. - if (m_prev == 0) { - if (this != wxDebugContext::GetHead ()) { - ErrorMsg ("No previous node for non-head node"); - return 0; - } - (void) wxDebugContext::SetHead (m_next); - } else { - if (! m_prev->AssertIt ()) { - ErrorMsg ("Trashed previous pointer"); - return 0; - } - - if (m_prev->m_next != this) { - ErrorMsg ("List is inconsistent"); - return 0; - } - m_prev->m_next = m_next; - } - - // Handle the part of the list after this node. - if (m_next == 0) { - if (this != wxDebugContext::GetTail ()) { - ErrorMsg ("No next node for non-tail node"); - return 0; - } - (void) wxDebugContext::SetTail (m_prev); - } else { - if (! m_next->AssertIt ()) { - ErrorMsg ("Trashed next pointer"); - return 0; - } - - if (m_next->m_prev != this) { - ErrorMsg ("List is inconsistent"); - return 0; - } - m_next->m_prev = m_prev; - } - - return 1; -} - - - -/* - Checks a node and block of memory to see that the markers are still - intact. -*/ -int wxMemStruct::CheckBlock () -{ - int nFailures = 0; - - if (m_firstMarker != MemStartCheck) { - nFailures++; - ErrorMsg (); - } - - char * pointer = wxDebugContext::MidMarkerPos ((char *) this); - if (* (wxMarkerType *) pointer != MemMidCheck) { - nFailures++; - ErrorMsg (); - } - - pointer = wxDebugContext::EndMarkerPos ((char *) this, RequestSize ()); - if (* (wxMarkerType *) pointer != MemEndCheck) { - nFailures++; - ErrorMsg (); - } - - return nFailures; -} - - -/* - Check the list of nodes to see if they are all ok. -*/ -int wxMemStruct::CheckAllPrevious () -{ - int nFailures = 0; - - for (wxMemStruct * st = this->m_prev; st != 0; st = st->m_prev) { - if (st->AssertIt ()) - nFailures += st->CheckBlock (); - else - return -1; - } - - return nFailures; -} - - -/* - When we delete a node we set the id slot to a specific value and then test - against this to see if a nodes have been deleted previously. I don't - just set the entire memory to the fillChar because then I'd be overwriting - useful stuff like the vtbl which may be needed to output the error message - including the file name and line numbers. Without this info the whole point - of this class is lost! -*/ -void wxMemStruct::SetDeleted () -{ - m_id = MemFillChar; -} - -int wxMemStruct::IsDeleted () -{ - return (m_id == MemFillChar); -} - - -/* - Print out a single node. There are many far better ways of doing this - but this will suffice for now. -*/ -void wxMemStruct::PrintNode () -{ - if (m_isObject) - { - wxObject *obj = (wxObject *)m_actualData; - wxClassInfo *info = obj->GetClassInfo(); - - // Let's put this in standard form so IDEs can load the file at the appropriate - // line - wxString msg; - - if (m_fileName) - msg.Printf(wxT("%s(%d): "), m_fileName, (int)m_lineNum); - - if (info && info->GetClassName()) - msg += info->GetClassName(); - else - msg += wxT("object"); - - wxString msg2; - msg2.Printf(wxT(" at %#zx, size %d"), wxPtrToUInt(GetActualData()), (int)RequestSize()); - msg += msg2; - - wxLogMessage(msg); - } - else - { - wxString msg; - - if (m_fileName) - msg.Printf(wxT("%s(%d): "), m_fileName, (int)m_lineNum); - msg += wxT("non-object data"); - wxString msg2; - msg2.Printf(wxT(" at %#zx, size %d\n"), wxPtrToUInt(GetActualData()), (int)RequestSize()); - msg += msg2; - - wxLogMessage(msg); - } -} - -void wxMemStruct::Dump () -{ - if (!ValidateNode()) return; - - if (m_isObject) - { - wxObject *obj = (wxObject *)m_actualData; - - wxString msg; - if (m_fileName) - msg.Printf(wxT("%s(%d): "), m_fileName, (int)m_lineNum); - - - /* TODO: We no longer have a stream (using wxLogDebug) so we can't dump it. - * Instead, do what wxObject::Dump does. - * What should we do long-term, eliminate Dumping? Or specify - * that MyClass::Dump should use wxLogDebug? Ugh. - obj->Dump(wxDebugContext::GetStream()); - */ - - if (obj->GetClassInfo() && obj->GetClassInfo()->GetClassName()) - msg += obj->GetClassInfo()->GetClassName(); - else - msg += wxT("unknown object class"); - - wxString msg2; - msg2.Printf(wxT(" at %#zx, size %d"), wxPtrToUInt(GetActualData()), (int)RequestSize()); - msg += msg2; - - wxDebugContext::OutputDumpLine(msg.c_str()); - } - else - { - wxString msg; - if (m_fileName) - msg.Printf(wxT("%s(%d): "), m_fileName, (int)m_lineNum); - - wxString msg2; - msg2.Printf(wxT("non-object data at %#zx, size %d"), wxPtrToUInt(GetActualData()), (int)RequestSize() ); - msg += msg2; - wxDebugContext::OutputDumpLine(msg.c_str()); - } -} - - -/* - Validate a node. Check to see that the node is "clean" in the sense - that nothing has over/underwritten it etc. -*/ -int wxMemStruct::ValidateNode () -{ - char * startPointer = (char *) this; - if (!AssertIt ()) { - if (IsDeleted ()) - ErrorMsg ("Object already deleted"); - else { - // Can't use the error routines as we have no recognisable object. -#ifndef __WXGTK__ - wxLogMessage(wxT("Can't verify memory struct - all bets are off!")); -#endif - } - return 0; - } - -/* - int i; - for (i = 0; i < wxDebugContext::TotSize (requestSize ()); i++) - cout << startPointer [i]; - cout << endl; -*/ - if (Marker () != MemStartCheck) - ErrorMsg (); - if (* (wxMarkerType *) wxDebugContext::MidMarkerPos (startPointer) != MemMidCheck) - ErrorMsg (); - if (* (wxMarkerType *) wxDebugContext::EndMarkerPos (startPointer, - RequestSize ()) != - MemEndCheck) - ErrorMsg (); - - // Back to before the extra buffer and check that - // we can still read what we originally wrote. - if (Marker () != MemStartCheck || - * (wxMarkerType *) wxDebugContext::MidMarkerPos (startPointer) - != MemMidCheck || - * (wxMarkerType *) wxDebugContext::EndMarkerPos (startPointer, - RequestSize ()) != MemEndCheck) - { - ErrorMsg (); - return 0; - } - - return 1; -} - -/* - The wxDebugContext class. -*/ - -wxMemStruct *wxDebugContext::m_head = nullptr; -wxMemStruct *wxDebugContext::m_tail = nullptr; - -bool wxDebugContext::m_checkPrevious = false; -int wxDebugContext::debugLevel = 1; -bool wxDebugContext::debugOn = true; -wxMemStruct *wxDebugContext::checkPoint = nullptr; - -// For faster alignment calculation -static wxMarkerType markerCalc[2]; -int wxDebugContext::m_balign = (int)((char *)&markerCalc[1] - (char*)&markerCalc[0]); -int wxDebugContext::m_balignmask = (int)((char *)&markerCalc[1] - (char*)&markerCalc[0]) - 1; - -// Pointer to global function to call at shutdown -wxShutdownNotifyFunction wxDebugContext::sm_shutdownFn; - -wxDebugContext::wxDebugContext() -{ -} - -wxDebugContext::~wxDebugContext() -{ -} - -/* - Work out the positions of the markers by creating an array of 2 markers - and comparing the addresses of the 2 elements. Use this number as the - alignment for markers. -*/ -size_t wxDebugContext::CalcAlignment () -{ - wxMarkerType ar[2]; - return (char *) &ar[1] - (char *) &ar[0]; -} - - -char * wxDebugContext::StructPos (const char * buf) -{ - return (char *) buf; -} - -char * wxDebugContext::MidMarkerPos (const char * buf) -{ - return StructPos (buf) + PaddedSize (sizeof (wxMemStruct)); -} - -char * wxDebugContext::CallerMemPos (const char * buf) -{ - return MidMarkerPos (buf) + PaddedSize (sizeof(wxMarkerType)); -} - - -char * wxDebugContext::EndMarkerPos (const char * buf, size_t size) -{ - return CallerMemPos (buf) + PaddedSize (size); -} - - -/* - Slightly different as this takes a pointer to the start of the caller - requested region and returns a pointer to the start of the buffer. - */ -char * wxDebugContext::StartPos (const char * caller) -{ - return ((char *) (caller - wxDebugContext::PaddedSize (sizeof(wxMarkerType)) - - wxDebugContext::PaddedSize (sizeof (wxMemStruct)))); -} - -/* - We may need padding between various parts of the allocated memory. - Given a size of memory, this returns the amount of memory which should - be allocated in order to allow for alignment of the following object. - - I don't know how portable this stuff is, but it seems to work for me at - the moment. It would be real nice if I knew more about this! - - // Note: this function is now obsolete (along with CalcAlignment) - // because the calculations are done statically, for greater speed. -*/ -size_t wxDebugContext::GetPadding (size_t size) -{ - size_t pad = size % CalcAlignment (); - return (pad) ? sizeof(wxMarkerType) - pad : 0; -} - -size_t wxDebugContext::PaddedSize (size_t size) -{ - // Added by Terry Farnham to replace - // slow GetPadding call. - int padb; - - padb = size & m_balignmask; - if(padb) - return(size + m_balign - padb); - else - return(size); -} - -/* - Returns the total amount of memory which we need to get from the system - in order to satisfy a caller request. This includes space for the struct - plus markers and the caller's memory as well. -*/ -size_t wxDebugContext::TotSize (size_t reqSize) -{ - return (PaddedSize (sizeof (wxMemStruct)) + PaddedSize (reqSize) + - 2 * sizeof(wxMarkerType)); -} - - -/* - Traverse the list of nodes executing the given function on each node. -*/ -void wxDebugContext::TraverseList (PmSFV func, wxMemStruct *from) -{ - if (!from) - from = wxDebugContext::GetHead (); - - wxMemStruct * st = nullptr; - for (st = from; st != 0; st = st->m_next) - { - void* data = st->GetActualData(); -// if ((data != (void*)m_debugStream) && (data != (void*) m_streamBuf)) - if (data != (void*) wxLog::GetActiveTarget()) - { - (st->*func) (); - } - } -} - - -/* - Print out the list. - */ -bool wxDebugContext::PrintList() -{ - TraverseList ((PmSFV)&wxMemStruct::PrintNode, (checkPoint ? checkPoint->m_next : nullptr)); - - return true; -} - -bool wxDebugContext::Dump() -{ - { - const wxChar* appName = wxT("application"); - wxString appNameStr; - if (wxTheApp) - { - appNameStr = wxTheApp->GetAppName(); - appName = appNameStr.c_str(); - OutputDumpLine(wxT("----- Memory dump of %s at %s -----"), appName, static_cast(wxNow().c_str())); - } - else - { - OutputDumpLine( wxT("----- Memory dump -----") ); - } - } - - TraverseList ((PmSFV)&wxMemStruct::Dump, (checkPoint ? checkPoint->m_next : nullptr)); - - OutputDumpLine(wxEmptyString); - OutputDumpLine(wxEmptyString); - - return true; -} - -struct wxDebugStatsStruct -{ - long instanceCount; - long totalSize; - wxChar *instanceClass; - wxDebugStatsStruct *next; -}; - -static wxDebugStatsStruct *FindStatsStruct(wxDebugStatsStruct *st, wxChar *name) -{ - while (st) - { - if (wxStrcmp(st->instanceClass, name) == 0) - return st; - st = st->next; - } - return nullptr; -} - -static wxDebugStatsStruct *InsertStatsStruct(wxDebugStatsStruct *head, wxDebugStatsStruct *st) -{ - st->next = head; - return st; -} - -bool wxDebugContext::PrintStatistics(bool detailed) -{ - { - const wxChar* appName = wxT("application"); - wxString appNameStr; - if (wxTheApp) - { - appNameStr = wxTheApp->GetAppName(); - appName = appNameStr.c_str(); - OutputDumpLine(wxT("----- Memory statistics of %s at %s -----"), appName, static_cast(wxNow().c_str())); - } - else - { - OutputDumpLine( wxT("----- Memory statistics -----") ); - } - } - - bool currentMode = GetDebugMode(); - SetDebugMode(false); - - long noNonObjectNodes = 0; - long noObjectNodes = 0; - long totalSize = 0; - - wxDebugStatsStruct *list = nullptr; - - wxMemStruct *from = (checkPoint ? checkPoint->m_next : nullptr ); - if (!from) - from = wxDebugContext::GetHead (); - - wxMemStruct *st; - for (st = from; st != 0; st = st->m_next) - { - void* data = st->GetActualData(); - if (detailed && (data != (void*) wxLog::GetActiveTarget())) - { - wxChar *className = (wxChar*) wxT("nonobject"); - if (st->m_isObject && st->GetActualData()) - { - wxObject *obj = (wxObject *)st->GetActualData(); - if (obj->GetClassInfo()->GetClassName()) - className = (wxChar*)obj->GetClassInfo()->GetClassName(); - } - wxDebugStatsStruct *stats = FindStatsStruct(list, className); - if (!stats) - { - stats = (wxDebugStatsStruct *)malloc(sizeof(wxDebugStatsStruct)); - stats->instanceClass = className; - stats->instanceCount = 0; - stats->totalSize = 0; - list = InsertStatsStruct(list, stats); - } - stats->instanceCount ++; - stats->totalSize += st->RequestSize(); - } - - if (data != (void*) wxLog::GetActiveTarget()) - { - totalSize += st->RequestSize(); - if (st->m_isObject) - noObjectNodes ++; - else - noNonObjectNodes ++; - } - } - - if (detailed) - { - while (list) - { - OutputDumpLine(wxT("%ld objects of class %s, total size %ld"), - list->instanceCount, list->instanceClass, list->totalSize); - wxDebugStatsStruct *old = list; - list = old->next; - free((char *)old); - } - OutputDumpLine(wxEmptyString); - } - - SetDebugMode(currentMode); - - OutputDumpLine(wxT("Number of object items: %ld"), noObjectNodes); - OutputDumpLine(wxT("Number of non-object items: %ld"), noNonObjectNodes); - OutputDumpLine(wxT("Total allocated size: %ld"), totalSize); - OutputDumpLine(wxEmptyString); - OutputDumpLine(wxEmptyString); - - return true; -} - -bool wxDebugContext::PrintClasses() -{ - { - const wxChar* appName = wxT("application"); - wxString appNameStr; - if (wxTheApp) - { - appNameStr = wxTheApp->GetAppName(); - appName = appNameStr.c_str(); - wxLogMessage(wxT("----- Classes in %s -----"), appName); - } - } - - int n = 0; - const wxClassInfo *info; - - for (wxClassInfo::const_iterator node = wxClassInfo::begin_classinfo(), - end = wxClassInfo::end_classinfo(); - node != end; ++node) - { - info = *node; - if (info->GetClassName()) - { - wxString msg(info->GetClassName()); - msg += wxT(" "); - - if (info->GetBaseClassName1() && !info->GetBaseClassName2()) - { - msg += wxT("is a "); - msg += info->GetBaseClassName1(); - } - else if (info->GetBaseClassName1() && info->GetBaseClassName2()) - { - msg += wxT("is a "); - msg += info->GetBaseClassName1() ; - msg += wxT(", "); - msg += info->GetBaseClassName2() ; - } - if (info->GetConstructor()) - msg += wxT(": dynamic"); - - wxLogMessage(msg); - } - n ++; - } - wxLogMessage(wxEmptyString); - wxLogMessage(wxT("There are %d classes derived from wxObject."), n); - wxLogMessage(wxEmptyString); - wxLogMessage(wxEmptyString); - return true; -} - -void wxDebugContext::SetCheckpoint(bool all) -{ - if (all) - checkPoint = nullptr; - else - checkPoint = m_tail; -} - -// Checks all nodes since checkpoint, or since start. -int wxDebugContext::Check(bool checkAll) -{ - int nFailures = 0; - - wxMemStruct *from = (checkPoint ? checkPoint->m_next : nullptr ); - if (!from || checkAll) - from = wxDebugContext::GetHead (); - - for (wxMemStruct * st = from; st != 0; st = st->m_next) - { - if (st->AssertIt ()) - nFailures += st->CheckBlock (); - else - return -1; - } - - return nFailures; -} - -// Count the number of non-wxDebugContext-related objects -// that are outstanding -int wxDebugContext::CountObjectsLeft(bool sinceCheckpoint) -{ - int n = 0; - - wxMemStruct *from = nullptr; - if (sinceCheckpoint && checkPoint) - from = checkPoint->m_next; - else - from = wxDebugContext::GetHead () ; - - for (wxMemStruct * st = from; st != 0; st = st->m_next) - { - void* data = st->GetActualData(); - if (data != (void*) wxLog::GetActiveTarget()) - n ++; - } - - return n ; -} - -// This function is used to output the dump -void wxDebugContext::OutputDumpLine(const wxChar *szFormat, ...) -{ - // a buffer of 2048 bytes should be long enough for a file name - // and a class name - wxChar buf[2048]; - int count; - va_list argptr; - va_start(argptr, szFormat); - buf[WXSIZEOF(buf)-1] = wxT('\0'); - - // keep 3 bytes for a \r\n\0 - count = wxVsnprintf(buf, WXSIZEOF(buf)-3, szFormat, argptr); - - if ( count < 0 ) - count = WXSIZEOF(buf)-3; - buf[count]=wxT('\r'); - buf[count+1]=wxT('\n'); - buf[count+2]=wxT('\0'); - - wxMessageOutputDebug dbgout; - dbgout.Printf(buf); -} - -void wxDebugContext::SetShutdownNotifyFunction(wxShutdownNotifyFunction shutdownFn) -{ - sm_shutdownFn = shutdownFn; -} - - -#if USE_THREADSAFE_MEMORY_ALLOCATION -static bool memSectionOk = false; - -class MemoryCriticalSection : public wxCriticalSection -{ -public: - MemoryCriticalSection() { - memSectionOk = true; - } - ~MemoryCriticalSection() { - memSectionOk = false; - } -}; - -class MemoryCriticalSectionLocker -{ -public: - inline MemoryCriticalSectionLocker(wxCriticalSection& critsect) - : m_critsect(critsect), m_locked(memSectionOk) { if(m_locked) m_critsect.Enter(); } - inline ~MemoryCriticalSectionLocker() { if(m_locked) m_critsect.Leave(); } - -private: - // no assignment operator nor copy ctor - MemoryCriticalSectionLocker(const MemoryCriticalSectionLocker&); - MemoryCriticalSectionLocker& operator=(const MemoryCriticalSectionLocker&); - - wxCriticalSection& m_critsect; - bool m_locked; -}; - -static MemoryCriticalSection memLocker; - -#endif // USE_THREADSAFE_MEMORY_ALLOCATION - - -#if !(defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE))) -#if wxUSE_GLOBAL_MEMORY_OPERATORS -void * operator new (size_t size, wxChar * fileName, int lineNum) -{ - return wxDebugAlloc(size, fileName, lineNum, false, false); -} - -void * operator new (size_t size) -{ - return wxDebugAlloc(size, nullptr, 0, false); -} - -void operator delete (void * buf) -{ - wxDebugFree(buf, false); -} - -#if wxUSE_ARRAY_MEMORY_OPERATORS -void * operator new[] (size_t size) -{ - return wxDebugAlloc(size, nullptr, 0, false, true); -} - -void * operator new[] (size_t size, wxChar * fileName, int lineNum) -{ - return wxDebugAlloc(size, fileName, lineNum, false, true); -} - -void operator delete[] (void * buf) -{ - wxDebugFree(buf, true); -} -#endif // wxUSE_ARRAY_MEMORY_OPERATORS -#endif // wxUSE_GLOBAL_MEMORY_OPERATORS -#endif // !(defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE))) - -// TODO: store whether this is a vector or not. -void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool WXUNUSED(isVect) ) -{ -#if USE_THREADSAFE_MEMORY_ALLOCATION - MemoryCriticalSectionLocker lock(memLocker); -#endif - - // If not in debugging allocation mode, do the normal thing - // so we don't leave any trace of ourselves in the node list. - - if (!wxDebugContext::GetDebugMode()) - { - return (void *)malloc(size); - } - - int totSize = wxDebugContext::TotSize (size); - char * buf = (char *) malloc(totSize); - if (!buf) { - wxLogMessage(wxT("Call to malloc (%ld) failed."), (long)size); - return 0; - } - wxMemStruct * st = (wxMemStruct *)buf; - st->m_firstMarker = MemStartCheck; - st->m_reqSize = size; - st->m_fileName = fileName; - st->m_lineNum = lineNum; - st->m_id = MemStructId; - st->m_prev = 0; - st->m_next = 0; - st->m_isObject = isObject; - - // Errors from Append() shouldn't really happen - but just in case! - if (st->Append () == 0) { - st->ErrorMsg ("Trying to append new node"); - } - - if (wxDebugContext::GetCheckPrevious ()) { - if (st->CheckAllPrevious () < 0) { - st->ErrorMsg ("Checking previous nodes"); - } - } - - // Set up the extra markers at the middle and end. - char * ptr = wxDebugContext::MidMarkerPos (buf); - * (wxMarkerType *) ptr = MemMidCheck; - ptr = wxDebugContext::EndMarkerPos (buf, size); - * (wxMarkerType *) ptr = MemEndCheck; - - // pointer returned points to the start of the caller's - // usable area. - void *m_actualData = (void *) wxDebugContext::CallerMemPos (buf); - st->m_actualData = m_actualData; - - return m_actualData; -} - -// TODO: check whether was allocated as a vector -void wxDebugFree(void * buf, bool WXUNUSED(isVect) ) -{ -#if USE_THREADSAFE_MEMORY_ALLOCATION - MemoryCriticalSectionLocker lock(memLocker); -#endif - - if (!buf) - return; - - // If not in debugging allocation mode, do the normal thing - // so we don't leave any trace of ourselves in the node list. - if (!wxDebugContext::GetDebugMode()) - { - free((char *)buf); - return; - } - - // Points to the start of the entire allocated area. - char * startPointer = wxDebugContext::StartPos ((char *) buf); - // Find the struct and make sure that it's identifiable. - wxMemStruct * st = (wxMemStruct *) wxDebugContext::StructPos (startPointer); - - if (! st->ValidateNode ()) - return; - - // If this is the current checkpoint, we need to - // move the checkpoint back so it points to a valid - // node. - if (st == wxDebugContext::checkPoint) - wxDebugContext::checkPoint = wxDebugContext::checkPoint->m_prev; - - if (! st->Unlink ()) - { - st->ErrorMsg ("Unlinking deleted node"); - } - - // Now put in the fill char into the id slot and the caller requested - // memory locations. - st->SetDeleted (); - (void) memset (wxDebugContext::CallerMemPos (startPointer), MemFillChar, - st->RequestSize ()); - - free((char *)st); -} - -// Trace: send output to the current debugging stream -void wxTrace(const wxChar * ...) -{ -#if 1 - wxFAIL_MSG(wxT("wxTrace is now obsolete. Please use wxDebugXXX instead.")); -#else - va_list ap; - static wxChar buffer[512]; - - va_start(ap, fmt); - -#ifdef __WINDOWS__ - wvsprintf(buffer,fmt,ap) ; -#else - vsprintf(buffer,fmt,ap) ; -#endif - - va_end(ap); - - if (wxDebugContext::HasStream()) - { - wxDebugContext::GetStream() << buffer; - wxDebugContext::GetStream().flush(); - } - else -#ifdef __WINDOWS__ -#ifdef __WIN32__ - OutputDebugString((LPCTSTR)buffer) ; -#else - OutputDebugString((const char*) buffer) ; -#endif -#else - fprintf(stderr, buffer); -#endif -#endif -} - -// Trace with level -void wxTraceLevel(int, const wxChar * ...) -{ -#if 1 - wxFAIL_MSG(wxT("wxTrace is now obsolete. Please use wxDebugXXX instead.")); -#else - if (wxDebugContext::GetLevel() < level) - return; - - va_list ap; - static wxChar buffer[512]; - - va_start(ap, fmt); - -#ifdef __WINDOWS__ - wxWvsprintf(buffer,fmt,ap) ; -#else - vsprintf(buffer,fmt,ap) ; -#endif - - va_end(ap); - - if (wxDebugContext::HasStream()) - { - wxDebugContext::GetStream() << buffer; - wxDebugContext::GetStream().flush(); - } - else -#ifdef __WINDOWS__ -#ifdef __WIN32__ - OutputDebugString((LPCTSTR)buffer) ; -#else - OutputDebugString((const char*) buffer) ; -#endif -#else - fprintf(stderr, buffer); -#endif -#endif -} - -//---------------------------------------------------------------------------- -// Final cleanup after all global objects in all files have been destroyed -//---------------------------------------------------------------------------- - -// Don't set it to 0 by dynamic initialization -// Some compilers will really do the assignment later -// All global variables are initialized to 0 at the very beginning, and this is just fine. -int wxDebugContextDumpDelayCounter::sm_count; - -wxDebugContextDumpDelayCounter::wxDebugContextDumpDelayCounter() -{ - sm_count++; -} - -wxDebugContextDumpDelayCounter::~wxDebugContextDumpDelayCounter() -{ - if ( !--sm_count ) - { - // Notify app if we've been asked to do that - if( wxDebugContext::sm_shutdownFn ) - wxDebugContext::sm_shutdownFn(); - DoDump(); - } -} - -void wxDebugContextDumpDelayCounter::DoDump() -{ - if (wxDebugContext::CountObjectsLeft(true) > 0) - { - wxDebugContext::OutputDumpLine(wxT("There were memory leaks.\n")); - wxDebugContext::Dump(); - wxDebugContext::PrintStatistics(); - } -} - -// Even if there is nothing else, make sure that there is at -// least one cleanup counter object -static wxDebugContextDumpDelayCounter wxDebugContextDumpDelayCounter_One; - -#endif // wxUSE_MEMORY_TRACING || wxUSE_DEBUG_CONTEXT diff --git a/src/common/object.cpp b/src/common/object.cpp index 96daf2c74c..68cb8e1c08 100644 --- a/src/common/object.cpp +++ b/src/common/object.cpp @@ -16,7 +16,6 @@ #ifndef WX_PRECOMP #include "wx/object.h" #include "wx/hash.h" - #include "wx/memory.h" #include "wx/crt.h" #endif @@ -89,61 +88,6 @@ bool wxObject::IsKindOf(const wxClassInfo *info) const return (thisInfo) ? thisInfo->IsKindOf(info) : false ; } -#if wxUSE_MEMORY_TRACING && defined( new ) - #undef new -#endif - - -#ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT -void *wxObject::operator new ( size_t size, const wxChar *fileName, int lineNum ) -{ - return wxDebugAlloc(size, (wxChar*) fileName, lineNum, true); -} -#endif - -#ifdef _WX_WANT_DELETE_VOID -void wxObject::operator delete ( void *buf ) -{ - wxDebugFree(buf); -} -#endif - -#ifdef _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET -void wxObject::operator delete ( void *buf, const char *_fname, size_t _line ) -{ - wxDebugFree(buf); -} -#endif - -#ifdef _WX_WANT_DELETE_VOID_WXCHAR_INT -void wxObject::operator delete ( void *buf, const wxChar *WXUNUSED(fileName), int WXUNUSED(lineNum) ) -{ - wxDebugFree(buf); -} -#endif - -#ifdef _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT -void *wxObject::operator new[] ( size_t size, const wxChar* fileName, int lineNum ) -{ - return wxDebugAlloc(size, (wxChar*) fileName, lineNum, true, true); -} -#endif - -#ifdef _WX_WANT_ARRAY_DELETE_VOID -void wxObject::operator delete[] ( void *buf ) -{ - wxDebugFree(buf, true); -} -#endif - -#ifdef _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT -void wxObject::operator delete[] (void * buf, const wxChar* WXUNUSED(fileName), int WXUNUSED(lineNum) ) -{ - wxDebugFree(buf, true); -} -#endif - - // ---------------------------------------------------------------------------- // wxClassInfo // ---------------------------------------------------------------------------- diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 7d1855860c..ea2d9c4a14 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -15,7 +15,6 @@ #include "wx/intl.h" #include "wx/log.h" #include "wx/utils.h" - #include "wx/memory.h" #include "wx/font.h" #endif diff --git a/src/osx/carbon/app.cpp b/src/osx/carbon/app.cpp index a4c48ea801..4bd645ea05 100644 --- a/src/osx/carbon/app.cpp +++ b/src/osx/carbon/app.cpp @@ -29,7 +29,6 @@ #include "wx/dialog.h" #include "wx/msgdlg.h" #include "wx/textctrl.h" - #include "wx/memory.h" #include "wx/gdicmn.h" #include "wx/module.h" #endif diff --git a/src/x11/app.cpp b/src/x11/app.cpp index 277e15aabf..340361c4ec 100644 --- a/src/x11/app.cpp +++ b/src/x11/app.cpp @@ -21,7 +21,6 @@ #include "wx/frame.h" #include "wx/icon.h" #include "wx/dialog.h" - #include "wx/memory.h" #include "wx/gdicmn.h" #include "wx/module.h" #include "wx/crt.h" diff --git a/tests/allheaders.h b/tests/allheaders.h index 5829607506..2bd780326d 100644 --- a/tests/allheaders.h +++ b/tests/allheaders.h @@ -220,7 +220,6 @@ #include #include #include -#include #include #include #include