Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by ramsayamarin · Jul 16, 2021 at 12:10 PM · errorbugpackageremoteservice

Remote Config Native Collection memory leak

Windows 10, Unity 2021.1.15f1, Remote Config 2.0.1, Android Build Target

I call Remote Config Fetch on Awake once on startup and it throws the error "A Native Collection has not been disposed, resulting in a memory leak. Allocated from: Unity.Collections.NativeArray`1:.ctor(Byte[], Allocator)"

It appears to occur here in ConfigManagerImpl:

 request.uploadHandler = new UploadHandlerRaw(Encoding.UTF8.GetBytes(jsonText));

Here is the full stack trace obtained using the Jobs package with Full Stack Traces:

 [Error] A Native Collection has not been disposed, resulting in a memory leak. Allocated from:
 Unity.Collections.NativeArray`1:.ctor(Byte[], Allocator)
 ConfigManagerImpl.DoRequest() at Library\PackageCache\com.unity.remote-config-runtime@1.0.1\Runtime\ConfigManagerImpl.cs:267
 265:       request.SetRequestHeader(header.key, header.value);
 266:   }
 -->267:   request.uploadHandler = new UploadHandlerRaw(Encoding.UTF8.GetBytes(jsonText));
 268:   request.downloadHandler = new DownloadHandlerBuffer();
 269:   request.SendWebRequest().completed += (AsyncOperation op) => {
 
 ConfigManagerImpl.PostConfig() at Library\PackageCache\com.unity.remote-config-runtime@1.0.1\Runtime\ConfigManagerImpl.cs:204
 202:   {
 203:       var jsonText = PreparePayload(userAttributes, appAttributes);
 -->204:       DoRequest(jsonText);
 205:   }
 
 ConfigManagerImpl.FetchConfigs() at Library\PackageCache\com.unity.remote-config-runtime@1.0.1\Runtime\ConfigManagerImpl.cs:188
 186:   public void FetchConfigs<T, T2>(T userAttributes, T2 appAttributes) where T : struct where T2 : struct
 187:   {
 -->188:       PostConfig(userAttributes, appAttributes);
 189:   }
 
 ConfigManager.FetchConfigs() at Library\PackageCache\com.unity.remote-config-runtime@1.0.1\Runtime\ConfigManager.cs:96
 94:   public static void FetchConfigs<T, T2>(T userAttributes, T2 appAttributes) where T : struct where T2 : struct
 95:   {
 -->96:       _configmanagerImpl.FetchConfigs(userAttributes, appAttributes);
 97:   }
 
 ConfigFetcher.Fetch() at Assets\Scripts\Common\Utilities\ConfigFetcher.cs:55
 54:       IsFetching = true;
 -->55:       ConfigManager.FetchConfigs<UserAttributes, AppAttributes>(new UserAttributes(), new AppAttributes());
 56:   }
 
 ConfigFetcher.Awake() at Assets\Scripts\Common\Utilities\ConfigFetcher.cs:34
 32:       ConfigManager.SetEnvironmentID(_environmentId);
 33:       ConfigManager.FetchCompleted += ApplyRemoteSettings;
 -->34:       Fetch();
 35:   }
 36:   else if (this != Instance)
 
 Object.Internal_CloneSingleWithParent()
 
 Object.Instantiate()
 
 Object.Instantiate()
 
 Object.Instantiate()
 
 PersistentObjectsInstantiator.Awake() at Assets\Scripts\Common\PersistantObjects\PersistentObjectsInstantiator.cs:27
 25:       }
 26:       DontDestroyOnLoad(gameObject);
 -->27:       _presistentObjects = Instantiate(PersistentObjects, transform);
 28:   }
 29:   else if (this != _instance)
 

Any idea how to fix this?

Comment
Add comment · Show 10
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image andrew-lukasik · Jul 16, 2021 at 12:53 PM 0
Share

Are you 100% positive there is no ConfigFetcher duplicates and/or ConfigManager.FetchConfigs cannot be called twice from elsewhere?

avatar image ramsayamarin andrew-lukasik · Jul 16, 2021 at 12:55 PM 0
Share

@andrew-lukasik Yes 100% sure, I set a break point now and it is only called once from Awake. I suspect the issue is UploadHandlerRaw is not wrapped inside a using statement.

avatar image andrew-lukasik · Jul 16, 2021 at 01:22 PM 0
Share

Side note: call stack says this is com.unity.remote-config-runtime@1.0.1 but you wrote it's Remote Config 2.0.1. Probably a typo.

avatar image ramsayamarin andrew-lukasik · Jul 16, 2021 at 01:25 PM 0
Share

@andrew-lukasik Yeah I did notice that but it isnt a typo, the package manager says Remote Config Release 2.0.1. I looked at the package file inside Remote Config, it says Version 2.0.1, then underneath inside dependences it says (com.unity.nuget.newtonsoft-json = 2.0.0) & (com.unity.remote-config-runtime = 1.0.1)

avatar image andrew-lukasik · Jul 16, 2021 at 01:33 PM 0
Share

Here is a source of this specific allocation: https://github.com/needle-mirror/com.unity.remote-config-runtime/blob/b8f3e1ed794f7e8ac18c9134bf8e830b889969df/Runtime/ConfigManagerImpl.cs#L267


This UploadHandlerRaw exposes a manual Dispose method but disposeUploadHandlerOnDispose is supposed to take care of that (it's set to true by default according to doc page).

avatar image andrew-lukasik andrew-lukasik · Jul 16, 2021 at 01:44 PM 0
Share

If you see this warning message once per run only and remote config works besides that just fine - then I wouldn't worry about it and move on to more important things.

But if this brakes your application then idk, tough one to diagnose. You can ask devs directly on dedicated unity forum too.

avatar image ramsayamarin andrew-lukasik · Jul 16, 2021 at 01:48 PM 0
Share

My issue is that it doesn't throw a warning but rather an error, I never ignored errors before :) Yes the application runs and retrieves the value, at least in the editor.

Show more comments

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

179 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Strange physics, rigidbody, iTween activity 1 Answer

I can't resume my engine,I can't resume my unity 1 Answer

I can't use google admob ads 1 Answer

press play, game objects get deleted, game breaks. 1 Answer

Does anyone know how to fix this? Yellow texture on imported objects. 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges