mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
[v3.6.0] Fix memory leaks (#12185)
This commit is contained in:
@@ -585,8 +585,12 @@ bool ScriptEngine::init(v8::Isolate *isolate) {
|
||||
_context.Reset(_isolate, context);
|
||||
_context.Get(isolate)->Enter();
|
||||
} else {
|
||||
static v8::ArrayBuffer::Allocator *arrayBufferAllocator{nullptr};
|
||||
if (arrayBufferAllocator == nullptr) {
|
||||
arrayBufferAllocator = v8::ArrayBuffer::Allocator::NewDefaultAllocator();
|
||||
}
|
||||
v8::Isolate::CreateParams createParams;
|
||||
createParams.array_buffer_allocator = v8::ArrayBuffer::Allocator::NewDefaultAllocator();
|
||||
createParams.array_buffer_allocator = arrayBufferAllocator;
|
||||
_isolate = v8::Isolate::New(createParams);
|
||||
v8::HandleScope hs(_isolate);
|
||||
_context.Reset(_isolate, v8::Context::New(_isolate));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "DragonBones.h"
|
||||
#include "../armature/Armature.h"
|
||||
#include "../animation/WorldClock.h"
|
||||
#include "../animation/Animation.h"
|
||||
#include "../animation/WorldClock.h"
|
||||
#include "../armature/Armature.h"
|
||||
#include "../event/EventObject.h"
|
||||
#include "../event/IEventDispatcher.h"
|
||||
|
||||
@@ -28,6 +28,7 @@ DragonBones::~DragonBones() {
|
||||
}
|
||||
|
||||
_clock = nullptr;
|
||||
delete _eventManager;
|
||||
_eventManager = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,9 @@ PlanarShadowQueue::PlanarShadowQueue(RenderPipeline *pipeline)
|
||||
_instancedQueue = ccnew RenderInstancedQueue;
|
||||
}
|
||||
|
||||
PlanarShadowQueue::~PlanarShadowQueue() = default;
|
||||
PlanarShadowQueue::~PlanarShadowQueue() {
|
||||
destroy();
|
||||
}
|
||||
|
||||
void PlanarShadowQueue::gatherShadowPasses(scene::Camera *camera, gfx::CommandBuffer *cmdBuffer) {
|
||||
clear();
|
||||
@@ -138,7 +140,10 @@ void PlanarShadowQueue::recordCommandBuffer(gfx::Device *device, gfx::RenderPass
|
||||
}
|
||||
|
||||
void PlanarShadowQueue::destroy() {
|
||||
_pipeline = nullptr;
|
||||
CC_SAFE_DELETE(_instancedQueue);
|
||||
_castModels.clear();
|
||||
_pendingModels.clear();
|
||||
}
|
||||
|
||||
} // namespace pipeline
|
||||
|
||||
@@ -90,7 +90,7 @@ void ForwardStage::destroy() {
|
||||
CC_SAFE_DELETE(_batchedQueue);
|
||||
CC_SAFE_DELETE(_instancedQueue);
|
||||
CC_SAFE_DELETE(_additiveLightQueue);
|
||||
CC_SAFE_DELETE(_planarShadowQueue);
|
||||
CC_SAFE_DESTROY_AND_DELETE(_planarShadowQueue);
|
||||
CC_SAFE_DELETE(_uiPhase);
|
||||
RenderStage::destroy();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user