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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

FStreamableManager is not GC safe

I have been recently starting using the FStreamableManager, and I believe it doesn't account for garbage collected objects properly. Everywhere in the wiki and documentation is suggested to access the FStreamableManager globally, from a singleton class, although when you do so, it is very likely that you will incur into the following issue.

FStreamableManager has as propery

typedef TMap TStreamableMap; TStreamableMap StreamableItems;

This map will be later used as a fast look up table not to re-load an object if already loaded. Although, because this map is not known to the GC (not a UPROPERTY and not a TArray), the UObject raw pointer stored in the FStreamable object (UObject* Target) is likely to be recycled. Therefore if the code is trying to load the same asset more than once, the streamable manager will find a reference in its map, although, the returned target pointer will point to a different object, invalidating the very initial reason for this map to exist.

I do understand that you might don't want to keep objects around in memory, hence the loose reference, although I find this interface at least easy to mis-use.

Simple solution for me at the moment is not to store a global FStreamableManager and re-declare one every time I need to load an asset.

Hope this helps to figure out some random crashes while using this API.

Product Version: UE 4.11
Tags:
more ▼

asked Apr 06 '16 at 10:51 PM in C++ Programming

avatar image

Fabio Polimeni
11 1 2 2

avatar image ColdSteel48 May 24 '18 at 10:28 AM

I think there is couple of methods to release the handle from this manager However it is sad that we should manage the FStreamableManager memory as well.

The biggest caveat for us to know when we want to release the handles :-| If multiple objects are involved then it is a headache.

Maybe we should let the manager to keep a hard ref to the asset, and explicitly release it when we know for sure that we don't need it anymore.

Redeclare every time adds more bugs as well - for example if your actor asked for async loading but it is destroyed before the manager loaded everything and GC ticked and the same time -> we will have another crash.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
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