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. 

GPU memory leak when using scenecapture2d capture on every frame with editable transform widget movement

I have a character blueprint with a scenecapture2d component set up under a camera component to get a first person view kind of effect. The camera is set to copy transforms from a transform type variable set to editable and show 3d widget is enabled. I noticed I was getting crashes when moving this widget in the world.

It seems like the scenecapture2d when set to capture every frame in combination with moving the transform widget allocates a lot of GPU memory. Nothing happens when the scenecapture2d is set to not capture on every frame. Also after the memory leakage if you compile the blueprint the memory usage is reset to normal levels. But if you don't compile the blueprint (or something similar) the memory stays allocated and can create a crash if you continue for example moving the widget. If the memory was reset upon stopping the movement of the widget I probably wouldn't have had any crashes and not notice this at all but it seems the memory stays in use even after moving it.

A basic repro case:

  1. Create a new blank project with starter content.

  2. Add a BP to the chair mesh.

  3. Create a render target texture.

  4. Add a scenecapture2d component to the BP and set it to use the render target texture. Confirm that it is set up to capture every frame.

  5. Create a variable and set it to the transform type, compile and set it to editable and enable 3d widget.

  6. Save the project.

  7. Disable position grid snapping and scrub the transform widget in the world forwards and backwards while monitoring GPU memory somehow (I use GPU Tweak II but something like GPU-Z should work too).

  8. Crash. (or stop before crashing)

  9. Repeat the same process but with capture on every frame disabled - should work fine.

Product Version: UE 4.15
more ▼

asked Mar 26 '17 at 07:56 PM in Rendering

avatar image

153 9 14 23

avatar image AndrewHurley Mar 27 '17 at 07:07 PM

Hey cyaoeu,

So I gathered your information and know that what you are experiencing is a known and expected issue. As long as you are adding a SceneCapture2D component and creating the render target within the blueprint itself (not the content browser), and then calling that blueprint to update every frame is expected to have memory consumption issues.

This is because when you call it to update every frame, it is literally creating a new render target every tick, which can quickly fill up your memory (especially the larger the render target resolutions). Blueprints only garbage collect ever so often without compiles, so all of your render targets are not being collected. Our developers also keep this in mind as there is a difference between the render target created in the content browser and how it behaves versus one created via the construction script.

Thank you,

Andrew Hurley

avatar image cyaoeu Mar 27 '17 at 07:55 PM

I am not creating the render target texture in blueprints though. In fact I have no blueprint code related to render targets in my test above. Just selecting the render target texture created in the content browser in the component (scene capture) is enough to cause memory issues when moving a widget like my example.

I mean if it's working as intended I don't have anything to say really but it seems a bit extreme that that checkbox alone should change the memory usage from basically nothing to 300-500MB/s with a 256x256 render target.

avatar image AndrewHurley Mar 27 '17 at 08:57 PM

Would you mind sharing with me a test project to make sure we are running identical tests? I have your steps, but I want be certain that the issue you are reporting is indeed a bug, because I do not want to rule out that possibility.


Andrew Hurley

avatar image cyaoeu Mar 28 '17 at 11:03 AM

Sure! Test project I removed the variable because just moving the object is enough. I just don't understand why CaptureEveryFrame is having a negative impact in the editor. Is there any workflow using a scenecapture2d and capturing every frame in the editor? For me capturing every frame is only important in the game itself so I would like to avoid the issues when moving such a component in the editor. For now I can work around it by either toggling off CaptureEveryFrame when moving things/widgets in the editor and then turning it back on again, or compiling blueprints randomly to garbage collect. It's a bit awkward though and if I forget to I might crash.

avatar image AndrewHurley Mar 28 '17 at 02:34 PM

There are a number of ways to enable/disable capturing of not only single frames, but enabling 'CaptureEveryFrame' only when you need it. This can be done as easily as exposing that variable to your blueprint, and calling it to enable/disable.

Assuming you are getting a Crash Report Window, would you mind providing me with your crash logs so I can use that information to gather more about the crash itself?

I am going to try and reproduce your issue as it is expected there are some memory concerns when creating the Render Target within the Construction Script, but this shouldn't occur when created within the Content Browser.

avatar image cyaoeu Mar 28 '17 at 07:52 PM

Thanks, for now I set the component to not capture in the component itself and set it to start capturing on begin play and it works fine.

I'm not getting the crash report window, I never have when running out of either RAM or VRAM. What I get is something like this: alt text

error.png (36.7 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey ,

Thanks for the clear and precise repro steps. I was able to confirm what you are reporting and have gone ahead and entered a bug report for the issue. You can track the report following the link below on our public issues tracker.


Once the issue has been addressed by our engineers the ticket will be updated and reflected in the public tracker. Let me know if you have further questions or need additional assistance.


Andrew Hurley

more ▼

answered Mar 29 '17 at 06:05 PM

avatar image cyaoeu Mar 29 '17 at 07:14 PM

Thanks! I can't view internal JIRA links though. Here's the issue tracker version! https://issues.unrealengine.com/issue/UE-43455

avatar image AndrewHurley Mar 31 '17 at 02:47 PM

Apologies! I've updated my link as well to point to the correct location.

(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