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"

UObject outer and GC

I'm trying to understand what an UObject's 'outer' really means, and how it affects GC. From my understanding, the only GC guarantee seems to be:

  • If you store UObject A pointer as a member of UObject B, and mark it as a UPROPERTY, that UObject A will stay alive as long as UObject B is alive

What I'm trying to understand is what effect the UObject's 'outer' actually has regarding GC. I was having some issues where:

  • UObject A gets created using NewObject(this) in some function inside UObject B, and used as a local scope varible (not a member)

  • When the game finishes, the GC runs and ensures everything is cleaned up

  • It goes through all UObjects and runs some code that, in between other things, tries to find each UObject's outermost UObject

  • There's a crash -> UObject A has it's outer set to an invalid (already deleted) UObject

So it seems that even though we set B as the outer of A, there isn't a guarantee that A will be deleted before B, and the cleanup check will fail as it can't find A's outer. So what does 'outer' actually do?

What we were trying to accomplish was the creation of local scope UObjects. We seem to have fixed it by not specifying the outer, and letting it default to GetTransientPackage() - however, without fully understanding what TransientPackage is, I don't feel like this is a proper fix and might just be working by luck in the GC run order.

Any clarification or help would be appreciated :)

Product Version: UE 4.14
more ▼

asked Mar 01 '17 at 05:10 PM in C++ Programming

avatar image

16 2 3 5

(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