master
neuecc 2020-06-09 14:52:04 +09:00
parent 37cd00d347
commit 3c0aa03643
2 changed files with 14 additions and 0 deletions

View File

@ -690,6 +690,8 @@ foreach (var (type, size) in TaskPool.GetCacheSizeInfo())
} }
``` ```
> In UnityEditor profiler shows allocation of compiler generated AsyncStateMachine but it only occurs in debug(development) build. C# Compiler generate AsyncStateMachine as class on Debug build and as struct on Release build. And also currently due to IL2CPP limitation, in IL2CPP build, UniTask do boxing AsyncStateMachine when needed so sometimes exists `one` allocation.
API References API References
--- ---
UniTask's API References is hosted at [cysharp.github.io/UniTask](https://cysharp.github.io/UniTask/api/Cysharp.Threading.Tasks.html) by [DocFX](https://dotnet.github.io/docfx/) and [Cysharp/DocfXTemplate](https://github.com/Cysharp/DocfxTemplate). UniTask's API References is hosted at [cysharp.github.io/UniTask](https://cysharp.github.io/UniTask/api/Cysharp.Threading.Tasks.html) by [DocFX](https://dotnet.github.io/docfx/) and [Cysharp/DocfXTemplate](https://github.com/Cysharp/DocfxTemplate).

View File

@ -45,7 +45,11 @@ namespace Cysharp.Threading.Tasks.CompilerServices
{ {
static TaskPool<AsyncUniTaskVoid<TStateMachine>> pool; static TaskPool<AsyncUniTaskVoid<TStateMachine>> pool;
#if ENABLE_IL2CPP
IAsyncStateMachine stateMachine; // unfortunatelly boxed to fix IL2CPP issue. IAsyncStateMachine stateMachine; // unfortunatelly boxed to fix IL2CPP issue.
#else
TStateMachine stateMachine;
#endif
public Action MoveNext { get; } public Action MoveNext { get; }
@ -113,7 +117,11 @@ namespace Cysharp.Threading.Tasks.CompilerServices
{ {
static TaskPool<AsyncUniTask<TStateMachine>> pool; static TaskPool<AsyncUniTask<TStateMachine>> pool;
#if ENABLE_IL2CPP
IAsyncStateMachine stateMachine; // unfortunatelly boxed to fix IL2CPP issue. IAsyncStateMachine stateMachine; // unfortunatelly boxed to fix IL2CPP issue.
#else
TStateMachine stateMachine;
#endif
public Action MoveNext { get; } public Action MoveNext { get; }
@ -224,7 +232,11 @@ namespace Cysharp.Threading.Tasks.CompilerServices
{ {
static TaskPool<AsyncUniTask<TStateMachine, T>> pool; static TaskPool<AsyncUniTask<TStateMachine, T>> pool;
#if ENABLE_IL2CPP
IAsyncStateMachine stateMachine; // unfortunatelly boxed to fix IL2CPP issue. IAsyncStateMachine stateMachine; // unfortunatelly boxed to fix IL2CPP issue.
#else
TStateMachine stateMachine;
#endif
public Action MoveNext { get; } public Action MoveNext { get; }