mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-07 13:47:06 -05:00
Fix memory leak caused by unreleased static references
This commit is contained in:
parent
c7212c7988
commit
69205182cd
|
|
@ -255,9 +255,10 @@ namespace UniGLTF
|
|||
}
|
||||
}
|
||||
|
||||
static Dictionary<Transform, IReadOnlyDictionary<Transform, TransformState>> PoseMap = new();
|
||||
static readonly Dictionary<Transform, IReadOnlyDictionary<Transform, TransformState>> PoseMap = new();
|
||||
|
||||
public static IReadOnlyDictionary<Transform, TransformState> SafeGetInitialPose(
|
||||
Transform root, bool useCache = true)
|
||||
Transform root, bool useCache = false)
|
||||
{
|
||||
if (useCache && PoseMap.TryGetValue(root, out var pose))
|
||||
{
|
||||
|
|
@ -278,7 +279,10 @@ namespace UniGLTF
|
|||
}
|
||||
|
||||
// add cache
|
||||
PoseMap.Add(root, pose);
|
||||
if (useCache)
|
||||
{
|
||||
PoseMap.Add(root, pose);
|
||||
}
|
||||
|
||||
return pose;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user