chexiongsheng / puerts_unreal_demo

unreal demo for puerts
MIT License
178 stars 80 forks source link

代理的内存泄露bug #23

Open narutosu opened 3 years ago

narutosu commented 3 years ago

import * as UE from 'ue' import {$ref, $unref, $set, argv, on, toManualReleaseDelegate, releaseManualReleaseDelegate} from 'puerts';

///////////////////////////////////////////////////////////////////////// let world = (argv.getByName("GameInstance") as UE.GameInstance).GetWorld(); let actor = world.SpawnActor(UE.MainActor.StaticClass(), undefined, UE.ESpawnActorCollisionHandlingMethod.Undefined, undefined, undefined) as UE.MainActor; function ggg(){ let arr = new Array(1000000); function MutiCast2(i) { if(arr){} } actor.NotifyWithInt.Add(MutiCast2) actor.NotifyWithInt.Remove(MutiCast2); }

for(let i=0;i<10;i++){ ggg() } actor = null