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"

Proper way to add a GC reference for a dynamically allocated UObject

I have an editor viewport client that I am working on that dynamically creates some proxies for tabs. It can reference them through its own overridden AddReferencedObjects() call, but that precludes them being dynamically allocated as needed.

What's the proper way to reference them at runtime?

Product Version: Not Selected
Tags:
more ▼

asked Feb 27 '15 at 09:28 AM in C++ Programming

avatar image

Backov
289 22 130 50

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

1 answer: sort voted first

Hi,

I am using AddToRoot, but I do not know if this is the proper way. Perhaps this helps:

http://www.reddit.com/r/unrealengine/comments/2cmi1k/memory_ownership_best_practices/

Greetings

more ▼

answered Mar 01 '15 at 01:42 PM

avatar image

ThisGuy5234
201 9 13 24

avatar image Backov Mar 04 '15 at 03:43 AM

This question was asked in ignorance of how AddReferencedObjects() works. I had assumed for some reason that it was called on startup/init of the owning object and thus couldn't handle objects added after that.

It's actually the opposite - it's called every time the GC runs. Which makes it work just fine for dynamic objects. As long as in the AddReferencedObjects() method it makes sure to reference all of its objects, it works just fine.

AddToRoot doesn't seem to be a good solution since it then means that the object is around forever (or at least until the game goes away.)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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