News › Forums › RAIN › General Discussion and Troubleshooting › When Loading BTAsset, GC Alloc a lot
This topic contains 12 replies, has 3 voices, and was last updated by
tgraupmann 1 month, 1 week ago.
-
AuthorPosts
-
February 13, 2022 at 6:14 am #7555
mind.behaviorTreeAsset = Resources.Load(string.Format(“BehaviorTrees/{0}”,”Guest”), typeof(BTAsset)) as BTAsset;
aiRig.AI.AIInit();The BT contains some Custom Action which need to load using Assembly.CreateInstance. In Unity Deep Profiler, it allocate a lot of memory, is it possible to minimize it ?
https://dl.dropboxusercontent.com/u/9322397/RAIN/Rain_AIInit.png
February 14, 2022 at 12:37 am #7628I don’t believe those numbers are accurate. For example, they are reporting String.Split taking 172KB. I don’t think that performing a split operation on a 30 character string requires almost 200k of memory. The similarly, calling type.Name doesn’t require 283K. I doubt it uses 283 bytes. In addition, the assembly sizes are skewed because you are running in the editor.
In general, the profiler serves as a guide for finding problems, but can be wildly inaccurate at times.
February 14, 2022 at 2:17 am #7630sorry, profile in editor is inaccurate, let me try to profile in device instead.
February 18, 2022 at 4:08 am #7918In Rain 1.x , when I load BT ( ~ 50 nodes, half of them is custom class in global assembly ) in runtime, it didn’t drop too much frame-rate, but after upgraded to Rain 2.x, it drop significantly, could you have any performance test case for this situation ?
March 4, 2022 at 10:56 am #8983I found that BTLoader is very slow when the BT contains many custom class in global assembly as it use reflection to create the class object. Any thing that I can do to make it load faster ?
March 4, 2022 at 6:29 pm #9018I’ll put a note in our task list to look into optimizing that. We can probably cache assemblies and check most recently used assemblies first.
March 5, 2022 at 2:13 am #9063Is your method used in RAIN 1.x for custom action ? I have no problem on it.
March 5, 2022 at 8:27 am #9081What is the time frame to optimize for caching the assemblies? If it is too long, we need to rollback to rain 1.x
March 6, 2022 at 5:35 pm #9276Send an email to jester please. We can discuss possibly getting you a pre-release custom version in advance of our planned release schedule.
March 7, 2022 at 2:21 am #9333email is sent.
March 17, 2022 at 2:19 am #9996I know you guys is busy, but how is the pre-release custom version ?
March 21, 2022 at 11:56 am #10357Working on it. Give me a ping on Monday.
December 13, 2022 at 3:37 pm #39709[moved]
-
This reply was modified 1 month, 1 week ago by
tgraupmann.
-
This reply was modified 1 month, 1 week ago by
tgraupmann.
-
This reply was modified 1 month, 1 week ago by
tgraupmann. Reason: simplify code example
-
This reply was modified 1 month, 1 week ago by
tgraupmann.
-
This reply was modified 1 month, 1 week ago by
tgraupmann.
-
This reply was modified 1 month, 1 week ago by
-
AuthorPosts
You must be logged in to reply to this topic.