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"

Widget component widget not garbage collected

If I add a widget component and then create a widget and set the widget in the component, then the widget is not garbage collected.

Note: The bottom "add widget component" doesn't have a widget class set.

alt text

Product Version: UE 4.17
Tags:
widget-gc.png (231.1 kB)
more ▼

asked Oct 29 '17 at 10:21 AM in Bug Reports

avatar image

DekanTrue
28 4 7 10

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

1 answer: sort voted first

Hello DekanTrue,

This is working as intended, if a widget is being referenced in a UObject it will remain in memory. I hope that this information helps.

Make it a great day

more ▼

answered Oct 30 '17 at 02:59 PM

avatar image

Rudy Q ♦♦ STAFF
47.2k 545 132 525

avatar image DekanTrue Oct 31 '17 at 10:23 AM

Hi Rudy,

Two things I don't understand then:

  1. How is the bottom example storing a reference to the widget, and the top example is not?

  2. Upon destroying the actor, shouldn't all references to the widget component disappear. The widget is still not garbage collected upon actor deconstruction. I have tried to remove widget from parent and remove the reference to the widget component with no result.

avatar image Rudy Q ♦♦ STAFF Oct 31 '17 at 02:10 PM

Neither widget will be removed from memory. One test you can run would be to use get all widgets of class and uncheck "Top Level Only". This a quick way to see how many of a certain widget are still in memory.

avatar image DekanTrue Oct 31 '17 at 09:02 PM

I have made that test yes. That is how I noticed the issue. Upon actor deconconstruction, if I force garbage collection, then the widget in the top example is cleaned. The bottom one is one.

avatar image Rudy Q ♦♦ STAFF Nov 13 '17 at 08:30 PM

A widget that is created using Create widget will look for the player, then the world, then the game instance. This means that unless all of them are removed (such as when the level is changed) the widget will continue to be referenced. As long as the widget is referenced, it will not be garbage collected.

(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