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"

Module Unload Helpers?

Is there any kind of helper/sanity check you guys have to assist module authors to remove all references to UI / memory your module has created and manages before it's unloaded? That way modules doesn't create duplicate windows, or menu items or leave stale event handlers...etc.

Product Version: Not Selected
Tags:
more ▼

asked Mar 11 '14 at 02:59 AM in Using UE4

avatar image

ue4-archive ♦♦ STAFF
49.8k 3650 1976 9103

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

1 answer: sort voted first

Currently, we don't have any sort of sanity check of that sort. If you use only weak pointers across modules and no shared pointers, there should be no memory leaks when a module gets unloaded, as all the weak pointers will invalidate themselves at the correct times, and you simply need to query if the weak pointers are valid to see.

What is exactly the issue that you are running into?

more ▼

answered Mar 11 '14 at 02:59 AM

avatar image

ue4-archive ♦♦ STAFF
49.8k 3650 1976 9103

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 02:59 AM

Hi Zane, I was more concerned about module reloads without restarts when I ran into this. Extension points holding onto smart pointers and difficult to diagnose crashes with no engine stack trace.

Figured it would be worth asking if there was a way to add metadata to allocations to track the module that allocated the dead pointer.

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 02:59 AM

Well, the idea behind extension points would be that in a new module, you would AddExtender's on module startup, and then RemoveExtender on module shutdown.

Having metadata which ties your smart pointer allocations to specific modules is an interesting idea. We don't have anything like that, but it might be interesting to consider for future releases.

Generally, the workflow for smart pointers is one of two things: If you just need one off data, pass weak pointers to other modules, and the other modules should simply be vigilant for the weak pointer invalidated OR (as the extensions manager currently works), have an Add and Remove pair of functions which are meant to be called at module startup and module shutdown, respectively.

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 02:59 AM

This got me thinking, the UI calls GetAllExtenders(), that clones and flattens the array of extenders with combine right? Doesn't seem like RemoveExtender would have any effect on the cloned list of extenders on shutdown and we'd continue to persist a copy of any smart pointer delegates in an extender.

Maybe the policy should be to only use weak pointer delegates in extenders?

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 02:59 AM

As mentioned before, UIs are not automatically regenerated until you reload or recompile the module which houses that UI. As such, removing an extender will not take effect until the reload (and using a weak pointer will not make a difference here either), since extenders are only used at UI creation time.

(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