You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I've been doing quite some testing in the Unity Editor. In the documentation, it's mentioned that the AsyncStateMachine method may generate garbage only in the Editor since a class is used (for builds, there're no allocations since a struct is used instead). Then, it'd have to do the pooling, so the first time UniTask runs, it might allocate quite some garbage.
However, for subsequent calls to UniTask (async UniTaskVoid), I saw no garbage allocations in the Editor (0 B).
To my surprise, when building and testing, I see 88 B of garbage allocated per UniTask call, and it has nothing to do with AsyncStateMachine, or pooling promise objects. With the "Deep Profile" enabled, I only can see the call to the UniTask, and right below (inside the UniTask itself), I always get "GC.Alloc --> 88 B", with no further details.
The way I'm seeing this is by using something like this:
privatevoidTriggerUniTask(){
TestUniTask(_taskVersion).Forget();}privateasync UniTaskVoid TestUniTask(inttaskVersion){while(Time.time -startTime<_animationTime){if(taskVersion!=_taskVersionScore)return;floatprogress=(Time.time -startTime)/_animationTime;// Do something that doesn't allocate garbageawait UniTask.Yield();}}
The text was updated successfully, but these errors were encountered:
Hi, I've been doing quite some testing in the Unity Editor. In the documentation, it's mentioned that the
AsyncStateMachine
method may generate garbage only in the Editor since a class is used (for builds, there're no allocations since a struct is used instead). Then, it'd have to do the pooling, so the first time UniTask runs, it might allocate quite some garbage.However, for subsequent calls to UniTask (
async UniTaskVoid
), I saw no garbage allocations in the Editor (0 B).To my surprise, when building and testing, I see 88 B of garbage allocated per UniTask call, and it has nothing to do with
AsyncStateMachine
, or pooling promise objects. With the "Deep Profile" enabled, I only can see the call to the UniTask, and right below (inside the UniTask itself), I always get "GC.Alloc --> 88 B", with no further details.The way I'm seeing this is by using something like this:
The text was updated successfully, but these errors were encountered: