x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[BUG ?] Why Async loadind asset Unload always fails ?

hello guys,

I'm working on a game and I got the task to optimize memory usage because we would like to port the game on console.

I'm using FStringAssetReference and StreamableManager to async load assets for the game.

.h

 UPROPERTY()
 FStringAssetReference tempRef;

.cpp

 void ACGameMode::LoadDummyTest()
 {
     UCGameInstance* gi = Cast<UCGameInstance>(GetGameInstance());
     if (gi)
         {
           tempRef.SetPath("/Game/Blueprints/Game/BP_Potato.Potato_C");
           gi->assetLoader.SimpleAsyncLoad(tempRef);
         }
 }
 
 void ACGameMode::UnloadDummyTest()
 {
     UCGameInstance* gi = Cast<UCGameInstance>(GetGameInstance());
     if (gi)
         {
            gi->assetLoader.Unload(tempRef);
         }
 }

For informations, theses 2 functioncs are blueprintcallable on separates buttons, the potato asset is a blueprint classs derived from custom actor c++ class and is not referenced anywhere.

Load works because the object weight is 126mb (yes I know is big)

but when I call upload nothing happens in memory and i manage to find this code below with a breakpoint in StreamableManager code :

none target

What the heck is that target with name "none" ? Where is came from ?

I mean when I load the asset I don't store it anywhere.

So later on the pre garbarge collector I got my weak target pointer assigned to this "none" name object :

pre garbage

Finally, on PostGarbage collector he failed to unload because my weak target is assigned to this "none" taget :

alt text

I also tested with RequestAsyncLoading with the same result.

What the hell is the "none" named target spawned from nowhere ??

Do someone is able to explain me why unload fails ?

Do you have any ideas ?

Could someone at epic staff could explains me that please ?

It's cool that you can load async, but if you cannot free memory it's bad.

I really need help, (3 days wandering around).

Thanks for any help.

Have agood day.

gamer08

Product Version: UE 4.12
Tags:
nonetarget.png (15.8 kB)
pre garbage.png (9.8 kB)
postgarbage.png (16.5 kB)
more ▼

asked Oct 15 '16 at 08:58 PM in Bug Reports

avatar image

gamer08
266 17 17 36

avatar image gamer08 Oct 16 '16 at 07:07 PM

Hello Guys, I manage to free memory if I call ConditionalBeginDestroy on the object after called StreamableManager Unload but I cant load anymore the asset, the manager don't find it.

I really need help on that one guys, I can't belive nobody successfully load and unload an asset with Unreal that's unbeliveble.

Is there a way to do it ?

Is it the right thing to do, calling ConditionnalBeginDestroyed on object after called Unload ?

Can someone at Epic can help on that one ?

because we need that to be able to port the game on console.

Also, what's the purpose of unload if it doesn't unload the asset ?

Wandering around for 4 days now and I really need help please.

Thanks

gamer08

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hey gamer08,

Thanks for the information. I am able to reproduce the issue you have described and entered a issue report for it. You can follow it here:

link text

more ▼

answered Oct 17 '16 at 03:19 PM

avatar image

ImVawx ♦♦ STAFF
6.7k 114 17 127

avatar image gamer08 Oct 17 '16 at 04:01 PM

Hello Kyle,

Thanks for you answer.

I maybe find a workaround that let me Load / Unload with that code below

 void ACGameMode::UnloadDummyTest()
  {
      UCGameInstance* gi = Cast<UCGameInstance>(GetGameInstance());
      if (gi)
          {
             gi->assetLoader.Unload(tempRef);
             tempRef.ResolveObject()->MarkPendingKill();
             GetWorld()->ForceGarbageCollection(true);
          }
  }

That way it's really unload.

Can you confirm that is good ? bad ? valid ? or invalid ?

Is there a better thing to do ?

Thanks

gamer08

P.S We use Unreal Engine 4.12.5 for the game and you marked 4.13 in the bug report

avatar image ImVawx ♦♦ STAFF Oct 17 '16 at 05:02 PM

If that works, I would say its fine, until they fix the issue with Unload.

If Unload is working and I simply missed something, I'll update this post with that information.

The bug exists in 4.13.1 and because its the most current release, that's what it will be logged under. (We log bugs under the most recent stable engine version available, that they exist in.)

avatar image gamer08 Oct 17 '16 at 05:18 PM

Hello Kyle,

Thanks for the answer. I will use this workaround for the moment.

I tested with RequestedAsync, SimpleAsync and SynchroneLoad and the workaround works.

I'll check this thread frequently for any updates, I may be missed something too. :)

Thanks again.

gamer08

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question