Open ka7713 opened 7 years ago
Steps to Reproduce:
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); AppDelegate app; Application::getInstance()->run(); return 0; }
Detected memory leaks! Dumping objects -> {211136} normal block at 0x12F2E9D8, 4 bytes long. Data: < > 00 00 00 00 ..................... 9613 lines ..................... {89196} normal block at 0x048E94C0, 44 bytes long. Data: < ?p X > E4 EE BF 05 00 00 80 3F 70 EB 8D 08 58 9E 8E 04 Object dump complete.
diff -x ''\''*.h'\''' -x ''\''*.cpp'\''' -ur D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/base/CCDirector.cpp D:\work\cocos2d-x-3.14.1/cocos/base/CCDirector.cpp --- D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/base/CCDirector.cpp 2017-01-18 10:57:42.000000000 +0900 +++ D:\work\cocos2d-x-3.14.1/cocos/base/CCDirector.cpp 2017-02-26 15:14:29.666814100 +0900 @@ -62,6 +62,12 @@ #include "base/CCAsyncTaskPool.h" #include "platform/CCApplication.h"
+#include "cocostudio/CCTransformHelp.h" +#include "base/ObjectFactory.h" +#include "3d/CCSprite3DMaterial.h" +#include "3d/CCSprite3D.h" +#include "extensions/Particle3D/PU/CCPUMaterialManager.h" +
@@ -210,6 +216,13 @@
Configuration::destroyInstance();
s_SharedDirector = nullptr; }
@@ -1081,13 +1094,17 @@
+ AnimationCache::destroyInstance();
// cocos2d-x specific data structures UserDefault::destroyInstance();
diff -x ''\''.h'\''' -x ''\''.cpp'\''' -ur D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/editor-support/cocostudio/CCTransformHelp.cpp D:\work\cocos2d-x-3.14.1/cocos/editor-support/cocostudio/CCTransformHelp.cpp --- D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/editor-support/cocostudio/CCTransformHelp.cpp 2017-01-18 10:57:42.000000000 +0900 +++ D:\work\cocos2d-x-3.14.1/cocos/editor-support/cocostudio/CCTransformHelp.cpp 2017-02-26 04:18:53.384811600 +0900 @@ -35,12 +35,17 @@ Vec2 TransformHelp::helpPoint1; Vec2 TransformHelp::helpPoint2;
-BaseData helpParentNode; +BaseData *helpParentNode = nullptr;
TransformHelp::TransformHelp() { }
+void TransformHelp::release() +{
CC_SAFE_DELETE(helpParentNode); +}
void TransformHelp::transformFromParent(BaseData &node, const BaseData &parentNode) { nodeToMatrix(node, helpMatrix1); @@ -65,13 +70,15 @@
void TransformHelp::transformFromParentWithoutScale(BaseData &node, const BaseData &parentNode) {
if (!helpParentNode)
helpParentNode = new BaseData;
helpParentNode.copy(&parentNode);
helpParentNode.scaleX = 1;
helpParentNode.scaleY = 1;
helpParentNode->copy(&parentNode);
helpParentNode->scaleX = 1;
helpParentNode->scaleY = 1;
nodeToMatrix(node, helpMatrix1);
nodeToMatrix(helpParentNode, helpMatrix2);
nodeToMatrix(*helpParentNode, helpMatrix2);
helpMatrix2 = AffineTransformInvert(helpMatrix2); helpMatrix1 = AffineTransformConcat(helpMatrix1, helpMatrix2); @@ -81,13 +88,14 @@
void TransformHelp::transformToParentWithoutScale(BaseData &node, const BaseData &parentNode) {
helpMatrix1 = AffineTransformConcat(helpMatrix1, helpMatrix2);
diff -x ''\''.h'\''' -x ''\''.cpp'\''' -ur D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/editor-support/cocostudio/CCTransformHelp.h D:\work\cocos2d-x-3.14.1/cocos/editor-support/cocostudio/CCTransformHelp.h --- D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/editor-support/cocostudio/CCTransformHelp.h 2017-01-18 10:57:42.000000000 +0900 +++ D:\work\cocos2d-x-3.14.1/cocos/editor-support/cocostudio/CCTransformHelp.h 2017-02-26 04:25:58.553020600 +0900 @@ -41,6 +41,8 @@ public: TransformHelp();
static void transformFromParent(BaseData &node, const BaseData &parentNode); static void transformToParent(BaseData &node, const BaseData &parentNode);
diff -x ''\''.h'\''' -x ''\''.cpp'\''' -ur D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/platform/desktop/CCGLViewImpl-desktop.cpp D:\work\cocos2d-x-3.14.1/cocos/platform/desktop/CCGLViewImpl-desktop.cpp --- D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/platform/desktop/CCGLViewImpl-desktop.cpp 2017-01-18 10:57:42.000000000 +0900 +++ D:\work\cocos2d-x-3.14.1/cocos/platform/desktop/CCGLViewImpl-desktop.cpp 2017-02-26 05:02:32.676988900 +0900 @@ -487,6 +487,17 @@ { if(_mainWindow) {
glfwSetWindowShouldClose(_mainWindow,1); _mainWindow = nullptr;
}
diff -x ''\''.h'\''' -x ''\''.cpp'\''' -ur D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/renderer/CCQuadCommand.cpp D:\work\cocos2d-x-3.14.1/cocos/renderer/CCQuadCommand.cpp --- D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/renderer/CCQuadCommand.cpp 2017-01-18 10:57:42.000000000 +0900 +++ D:\work\cocos2d-x-3.14.1/cocos/renderer/CCQuadCommand.cpp 2017-02-26 04:58:24.233604600 +0900 @@ -85,8 +85,9 @@
CCLOG("cocos2d: QuadCommand: resizing index size from [%d] to [%d]", __indexCapacity, indicesCount);
__indexCapacity = indicesCount;
diff -x ''\''.h'\''' -x ''\''.cpp'\''' -ur D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/extensions/Particle3D/PU/CCPUMaterialManager.cpp D:\work\cocos2d-x-3.14.1/extensions/Particle3D/PU/CCPUMaterialManager.cpp --- D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/extensions/Particle3D/PU/CCPUMaterialManager.cpp 2017-01-18 10:57:44.000000000 +0900 +++ D:\work\cocos2d-x-3.14.1/extensions/Particle3D/PU/CCPUMaterialManager.cpp 2017-02-26 15:17:59.310606900 +0900 @@ -44,6 +44,8 @@ NS_CC_BEGIN
+PUMaterialCache* PUMaterialCache::s_instance = nullptr; + PUMaterial::PUMaterial() : isEnabledLight(true) , ambientColor(Vec4::ONE) @@ -74,8 +76,14 @@
PUMaterialCache* PUMaterialCache::Instance() {
+void PUMaterialCache::destroyInstance() +{
CC_SAFE_DELETE(s_instance); }
PUMaterial PUMaterialCache::getMaterial( const std::string &name ) diff -x ''\''.h'\''' -x ''\''*.cpp'\''' -ur D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/extensions/Particle3D/PU/CCPUMaterialManager.h D:\work\cocos2d-x-3.14.1/extensions/Particle3D/PU/CCPUMaterialManager.h --- D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/extensions/Particle3D/PU/CCPUMaterialManager.h 2016-11-18 13:51:48.000000000 +0900 +++ D:\work\cocos2d-x-3.14.1/extensions/Particle3D/PU/CCPUMaterialManager.h 2017-02-26 15:17:08.664096900 +0900 @@ -62,6 +62,7 @@ ~PUMaterialCache();
static PUMaterialCache* Instance();
static void destroyInstance();
bool loadMaterials(const std::string &file); bool loadMaterialsFromSearchPaths(const std::string &fileFolder); @@ -72,6 +73,7 @@
typedef std::vector<PUMaterial *> MaterialVector; MaterialVector _materialMap;
static PUMaterialCache* s_instance; };
NS_CC_END
why not send a PR? It is hard to read the patch
Steps to Reproduce:
+#include "cocostudio/CCTransformHelp.h" +#include "base/ObjectFactory.h" +#include "3d/CCSprite3DMaterial.h" +#include "3d/CCSprite3D.h" +#include "extensions/Particle3D/PU/CCPUMaterialManager.h" +
if CC_ENABLE_SCRIPT_BINDING
include "base/CCScriptSupport.h"
endif
@@ -210,6 +216,13 @@
s_SharedDirector = nullptr; }
@@ -1081,13 +1094,17 @@
elif _MSC_VER >= 1400 //vs 2005 or higher
pragma warning (pop)
endif
+ AnimationCache::destroyInstance();
// cocos2d-x specific data structures UserDefault::destroyInstance();
diff -x ''\''.h'\''' -x ''\''.cpp'\''' -ur D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/editor-support/cocostudio/CCTransformHelp.cpp D:\work\cocos2d-x-3.14.1/cocos/editor-support/cocostudio/CCTransformHelp.cpp --- D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/editor-support/cocostudio/CCTransformHelp.cpp 2017-01-18 10:57:42.000000000 +0900 +++ D:\work\cocos2d-x-3.14.1/cocos/editor-support/cocostudio/CCTransformHelp.cpp 2017-02-26 04:18:53.384811600 +0900 @@ -35,12 +35,17 @@ Vec2 TransformHelp::helpPoint1; Vec2 TransformHelp::helpPoint2;
-BaseData helpParentNode; +BaseData *helpParentNode = nullptr;
TransformHelp::TransformHelp() { }
+void TransformHelp::release() +{
CC_SAFE_DELETE(helpParentNode); +}
void TransformHelp::transformFromParent(BaseData &node, const BaseData &parentNode) { nodeToMatrix(node, helpMatrix1); @@ -65,13 +70,15 @@
void TransformHelp::transformFromParentWithoutScale(BaseData &node, const BaseData &parentNode) {
if (!helpParentNode)
helpParentNode = new BaseData;
helpParentNode.copy(&parentNode);
helpParentNode.scaleX = 1;
helpParentNode.scaleY = 1;
helpParentNode->copy(&parentNode);
helpParentNode->scaleX = 1;
helpParentNode->scaleY = 1;
nodeToMatrix(node, helpMatrix1);
nodeToMatrix(helpParentNode, helpMatrix2);
nodeToMatrix(*helpParentNode, helpMatrix2);
helpMatrix2 = AffineTransformInvert(helpMatrix2); helpMatrix1 = AffineTransformConcat(helpMatrix1, helpMatrix2); @@ -81,13 +88,14 @@
void TransformHelp::transformToParentWithoutScale(BaseData &node, const BaseData &parentNode) {
helpParentNode.copy(&parentNode);
helpParentNode.scaleX = 1;
helpParentNode.scaleY = 1;
if (!helpParentNode)
helpParentNode = new BaseData;
helpParentNode->copy(&parentNode);
helpParentNode->scaleX = 1;
helpParentNode->scaleY = 1;
nodeToMatrix(node, helpMatrix1);
nodeToMatrix(helpParentNode, helpMatrix2);
nodeToMatrix(*helpParentNode, helpMatrix2);
helpMatrix1 = AffineTransformConcat(helpMatrix1, helpMatrix2);
diff -x ''\''.h'\''' -x ''\''.cpp'\''' -ur D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/editor-support/cocostudio/CCTransformHelp.h D:\work\cocos2d-x-3.14.1/cocos/editor-support/cocostudio/CCTransformHelp.h --- D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/editor-support/cocostudio/CCTransformHelp.h 2017-01-18 10:57:42.000000000 +0900 +++ D:\work\cocos2d-x-3.14.1/cocos/editor-support/cocostudio/CCTransformHelp.h 2017-02-26 04:25:58.553020600 +0900 @@ -41,6 +41,8 @@ public: TransformHelp();
static void transformFromParent(BaseData &node, const BaseData &parentNode); static void transformToParent(BaseData &node, const BaseData &parentNode);
diff -x ''\''.h'\''' -x ''\''.cpp'\''' -ur D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/platform/desktop/CCGLViewImpl-desktop.cpp D:\work\cocos2d-x-3.14.1/cocos/platform/desktop/CCGLViewImpl-desktop.cpp --- D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/platform/desktop/CCGLViewImpl-desktop.cpp 2017-01-18 10:57:42.000000000 +0900 +++ D:\work\cocos2d-x-3.14.1/cocos/platform/desktop/CCGLViewImpl-desktop.cpp 2017-02-26 05:02:32.676988900 +0900 @@ -487,6 +487,17 @@ { if(_mainWindow) {
}
diff -x ''\''.h'\''' -x ''\''.cpp'\''' -ur D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/renderer/CCQuadCommand.cpp D:\work\cocos2d-x-3.14.1/cocos/renderer/CCQuadCommand.cpp --- D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/cocos/renderer/CCQuadCommand.cpp 2017-01-18 10:57:42.000000000 +0900 +++ D:\work\cocos2d-x-3.14.1/cocos/renderer/CCQuadCommand.cpp 2017-02-26 04:58:24.233604600 +0900 @@ -85,8 +85,9 @@
}
diff -x ''\''.h'\''' -x ''\''.cpp'\''' -ur D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/extensions/Particle3D/PU/CCPUMaterialManager.cpp D:\work\cocos2d-x-3.14.1/extensions/Particle3D/PU/CCPUMaterialManager.cpp --- D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/extensions/Particle3D/PU/CCPUMaterialManager.cpp 2017-01-18 10:57:44.000000000 +0900 +++ D:\work\cocos2d-x-3.14.1/extensions/Particle3D/PU/CCPUMaterialManager.cpp 2017-02-26 15:17:59.310606900 +0900 @@ -44,6 +44,8 @@ NS_CC_BEGIN
+PUMaterialCache* PUMaterialCache::s_instance = nullptr; + PUMaterial::PUMaterial() : isEnabledLight(true) , ambientColor(Vec4::ONE) @@ -74,8 +76,14 @@
PUMaterialCache* PUMaterialCache::Instance() {
+void PUMaterialCache::destroyInstance() +{
CC_SAFE_DELETE(s_instance); }
PUMaterial PUMaterialCache::getMaterial( const std::string &name ) diff -x ''\''.h'\''' -x ''\''*.cpp'\''' -ur D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/extensions/Particle3D/PU/CCPUMaterialManager.h D:\work\cocos2d-x-3.14.1/extensions/Particle3D/PU/CCPUMaterialManager.h --- D:\download\cocos2d-x-3.14.1\cocos2d-x-3.14.1/extensions/Particle3D/PU/CCPUMaterialManager.h 2016-11-18 13:51:48.000000000 +0900 +++ D:\work\cocos2d-x-3.14.1/extensions/Particle3D/PU/CCPUMaterialManager.h 2017-02-26 15:17:08.664096900 +0900 @@ -62,6 +62,7 @@ ~PUMaterialCache();
static PUMaterialCache* Instance();
static void destroyInstance();
bool loadMaterials(const std::string &file); bool loadMaterialsFromSearchPaths(const std::string &fileFolder); @@ -72,6 +73,7 @@
typedef std::vector<PUMaterial *> MaterialVector; MaterialVector _materialMap;
static PUMaterialCache* s_instance; };
NS_CC_END