Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using too much memory #7

Open
MetaAlms opened this issue Oct 19, 2023 · 0 comments
Open

Using too much memory #7

MetaAlms opened this issue Oct 19, 2023 · 0 comments

Comments

@MetaAlms
Copy link

"I ran the 'Defender' demo on iOS, and I noticed that the memory usage keeps increasing when I change outfits or switch hairstyles. When I try to destroy the previous hairstyle, the memory growth slows down, but it still continues to increase, eventually causing the phone to crash due to excessive memory usage. I can see that the 'DestroyHairObjects' method is being called in the 'HairFXGroom' code, but for some reason, it's not releasing all the memory. What should I do?"

If you are facing memory issues in the 'Defender' demo on iOS, it might be a technical problem related to the game's code or how memory management is handled within the application. You may want to reach out to the developers of the demo or the game's support team for assistance in troubleshooting and resolving this memory-related problem.

我在ios上运行了defender这个demo,当我换装、切换头发的时候,我发现内存越来越高,当我尝试销毁上一个头发的时候,增速放缓,但是依然会增加,导致手机因内存过大而崩溃,我看HairFXGroom代码里也确实走了DestroyHairObjects这个方法,但是不知什么原因无法全部释放,我该如何操作?

Device: iPhone15, iOS17.0

截屏2023-10-19 15 49 17
截屏2023-10-19 15 56 47
截屏2023-10-19 15 57 25
截屏2023-10-19 16 36 34
IMG_0001

public void ChangeHairStyle(int index)
{
    //Debug.Log($"index: {index}");
    
    if (lastHair != null)
    {
        if (lastHair.TryGetComponent<HairFXSimulation>(out var simulation))
        {
            simulation.enableSimulation = false;
            Destroy(simulation);
        }
        
        if (lastHair.TryGetComponent<HairFXGroom>(out var groom))
        {
            groom.enabled = false;
            Destroy(groom);
        }
        
        Destroy(lastHair);
    }
    index %= hairStyles.Length;
    GameObject hair = Instantiate(hairStyles[index], Vector3.zero, quaternion.identity, hairGroups.transform);
    lastHair = hair;
}

Thread Performance Checker: Thread running at User-interactive quality-of-service class waiting on a thread without a QoS class specified. Investigate ways to avoid priority inversions
PID: 25760, TID: 1672985
Backtrace

3 UnityFramework 0x000000010aac14d4 _ZN12UnityClassic31Baselib_SystemSemaphore_AcquireENS_30Baselib_SystemSemaphore_HandleE + 28
4 UnityFramework 0x000000010a6f11c8 _ZN15GfxDeviceClient16CreateGpuProgramE20ShaderGpuProgramTypeRK13dynamic_arrayIhLm0EER22CreateGpuProgramOutput + 424
5 UnityFramework 0x000000010a5e256c _ZN9ShaderLab10SubProgram7CompileERNS_15CompilationDataE + 1156
6 UnityFramework 0x000000010a5e3a2c _ZNK9ShaderLab7Program40EnsureCompiledAndMarkUnsupportedIfFailedEPKNS_10SubProgramEiRKN8keywords17LocalKeywordStateEPS5_R19ShaderSnippetResult + 164
7 UnityFramework 0x000000010a5e3ea4 _ZNK9ShaderLab7Program21GetMatchingSubProgramEPK6ShaderPKNS_4PassERKN8keywords17LocalKeywordStateEjPS8_R19ShaderSnippetResult26AsyncShaderCompilationModebii + 888
8 UnityFramework 0x000000010a5dba48 _ZNK9ShaderLab11ShaderState20FindSubProgramsToUseEPK6ShaderPKNS_4PassERNS_11SubProgramsERK17ShaderPassContextRKN8keywords17LocalKeywordStateEbii + 204
9 UnityFramework 0x000000010a5d9508 _ZNK9ShaderLab11ShaderState16ApplyShaderStateEjPK19ShaderPropertySheetRK17ShaderPassContextRKN8keywords17LocalKeywordStateEP6ShaderPNS_4PassEPbPNS_11SubProgramsEPK22DeviceRenderStateBlockii + 144
10 UnityFramework 0x000000010a5d941c _ZN9ShaderLab4Pass9ApplyPassEjPK19ShaderPropertySheetR17ShaderPassContextRKN8keywords17LocalKeywordStateEP6ShaderiiPbPKNS_10GrabPassesEPNS_11SubProgramsEPK22DeviceRenderStateBlock + 160
11 UnityFramework 0x000000010a5c3f14 _Z26ApplyMaterialPassWithCacheRK18SharedMaterialDataR17ShaderPassContextP6ShaderPN9ShaderLab4PassEiibPKNS6_10GrabPassesEPNS6_11SubProgramsEPK22DeviceRenderStateBlock + 356
12 UnityFramework 0x000000010a5b2f10 _ZN8Material11SetPassFastEPN9ShaderLab4PassER17ShaderPassContextP6ShaderiibPNS0_11SubProgramsE + 276
13 UnityFramework 0x000000010a5b307c _ZN8Material21SetPassSlowWithShaderEP6ShaderiR17ShaderPassContextib + 104
14 UnityFramework 0x000000010a812480 ZN2UI6Canvas11DrawRawMeshERNS_5BatchEP9GfxBufferS4 + 492
15 UnityFramework 0x000000010a8127dc _ZN2UI6Canvas14RenderOverlaysEv + 172
16 UnityFramework 0x000000010a81ca8c _ZN2UI13CanvasManager14RenderOverlaysEi + 228
17 UnityFramework 0x000000010a588460 _Z12PlayerRenderb + 712
18 UnityFramework 0x000000010a5896d8 _Z17ExecutePlayerLoopP22NativePlayerLoopSystem + 100
19 UnityFramework 0x000000010a589718 _Z17ExecutePlayerLoopP22NativePlayerLoopSystem + 164
20 UnityFramework 0x000000010a589974 _Z10PlayerLoopv + 272
21 UnityFramework 0x000000010aa1b974 _ZL19UnityPlayerLoopImplb + 112
22 UnityFramework 0x0000000109e2b678 UnityRepaint + 28
23 UnityFramework 0x0000000109e2b64c -[UnityAppController(Rendering) repaint] + 116
24 UnityFramework 0x0000000109e2b59c -[UnityAppController(Rendering) repaintDisplayLink] + 120
25 QuartzCore 0x00000001b317c0f4 0FB9E837-C0AA-3977-A0BE-28BA0F207A50 + 196852
26 QuartzCore 0x00000001b317f2dc 0FB9E837-C0AA-3977-A0BE-28BA0F207A50 + 209628
27 QuartzCore 0x00000001b317ede8 0FB9E837-C0AA-3977-A0BE-28BA0F207A50 + 208360
28 QuartzCore 0x00000001b31fd378 0FB9E837-C0AA-3977-A0BE-28BA0F207A50 + 725880
29 UIKitCore 0x00000001b3e12d94 948B271A-D49D-3B3F-AC08-2223908F51AB + 699796
30 UIKitCore 0x00000001b3e12484 948B271A-D49D-3B3F-AC08-2223908F51AB + 697476
31 UIKitCore 0x00000001b3e12540 948B271A-D49D-3B3F-AC08-2223908F51AB + 697664
32 CoreFoundation 0x00000001b1b8cacc CEB74A0C-5EA4-3F5A-9DE8-73F0DAD2F4CB + 228044
33 CoreFoundation 0x00000001b1b8bd48 CEB74A0C-5EA4-3F5A-9DE8-73F0DAD2F4CB + 224584
34 CoreFoundation 0x00000001b1b8a4fc CEB74A0C-5EA4-3F5A-9DE8-73F0DAD2F4CB + 218364
35 CoreFoundation 0x00000001b1b89238 CEB74A0C-5EA4-3F5A-9DE8-73F0DAD2F4CB + 213560
36 CoreFoundation 0x00000001b1b88e18 CFRunLoopRunSpecific + 608
37 GraphicsServices 0x00000001f46455ec GSEventRunModal + 164
38 UIKitCore 0x00000001b3f97350 948B271A-D49D-3B3F-AC08-2223908F51AB + 2290512
39 UIKitCore 0x00000001b3f9698c UIApplicationMain + 340
40 UnityFramework 0x0000000109e2ae68 -[UnityFramework runUIApplicationMainWithArgc:argv:] + 136
41 HairFX-TressFX 0x00000001005f41d0 main + 76
42 dyld 0x00000001d436bd44 1366C02B-1A31-33C8-BE06-D44C8C8E0310 + 23876
<0x1090b4a90> Gesture: System gesture gate timed out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant