Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High memory usage on Windows #328

Closed
fwcd opened this issue May 1, 2020 · 12 comments
Closed

High memory usage on Windows #328

fwcd opened this issue May 1, 2020 · 12 comments
Labels
bug Something isn't working
Milestone

Comments

@fwcd
Copy link

fwcd commented May 1, 2020

First of all, thanks for making this amazing crate! Having a modern GUI library is definitely a great step forward towards building desktop applications in Rust.

I've noticed though that the default renderer on Windows allocates very large amounts of memory (sometimes even causing the app to crash), specifically when clicking and dragging with the mouse:

demo

Any ideas on this?

@hecrj
Copy link
Member

hecrj commented May 1, 2020

Do the wgpu-rs examples display the same issue for you? Are your (integrated) graphics drivers up-to-date? Does it happen only when selecting text?

gfx-memory recently fixed some issues. You could try running cargo update.

In any case, I don't believe we have code that could cause the renderer to leak or allocate memory like that. I will try to investigate further.

@hecrj hecrj added the bug Something isn't working label May 1, 2020
@hecrj hecrj added this to the 0.2.0 milestone May 1, 2020
@fwcd
Copy link
Author

fwcd commented May 1, 2020

Yeah, I am running the latest graphics drivers and have the newest library versions too.

I did some quick profiling of the app in Visual Studio (while selecting text, just as in the GIF above) and found that it spends most of its time in the event loop, drawing:

grafik

grafik

Maybe the app enqueues too many events and thereby overloads the queue since the loop cannot keep up?

@hecrj
Copy link
Member

hecrj commented May 1, 2020

Maybe the app enqueues too many events and thereby overloads the queue since the loop cannot keep up?

I think this is unlikely. The queue is drained before drawing every time and we are not seeing increased latency. Does the memory usage decrease once you stop moving the mouse?

It would help me if you could answer my other questions:

  • Do the wgpu-rs examples display the same issue for you?
  • Does it happen only when selecting text? What about the repository examples?

And additionally:

  • What is your GPU? Does it support Vulkan?

@fwcd
Copy link
Author

fwcd commented May 1, 2020

None of the examples (neither here, nor in wgpu) produced the issue, so I tried upgrading from iced 0.1.x (the most recent release) to the latest master of iced and that solved the problem. Maybe it was indeed one of the recent gfx-extras fixes.

Thank you!

@fwcd fwcd closed this as completed May 1, 2020
@sum-elier
Copy link
Contributor

sum-elier commented May 1, 2020

@hecrj I am having the same problem with the Todos example. I have:

  • Windows 10 Pro build 1909.
  • GPU: Asus Strix GTX 970. Latest drivers.
  • Latest Iced repo version.

Demo

issue_324_demo

@sum-elier
Copy link
Contributor

@fwcd Can you please reopen the issue since I am experiencing the same problem using the latest Iced version 😟

@hecrj
Copy link
Member

hecrj commented May 1, 2020

@sum-elier

  • Do the wgpu-rs examples display the same issue for you?
  • Does it happen only when selecting text?

@fwcd
Copy link
Author

fwcd commented May 1, 2020

@sum-elier I'm sorry, I don't see the issue in your demo. This memory usage looks pretty normal to me.

@sum-elier
Copy link
Contributor

@fwcd I am sorry, you are right. I was looking at the cpu usage though. I guess that is normal then?

@sum-elier
Copy link
Contributor

sum-elier commented May 1, 2020

@sum-elier

* Do the wgpu-rs examples display the same issue for you?

* Does it happen only when selecting text?

@hecrj As @fwcd pointed out, my memory usage is alright. I was confused and was looking at the cpu usage. Tried the demos from wgpu-rs (cube and hello-triangle) and they seem to consume around 31% of cpu so I guess what I saw here is normal

@hecrj
Copy link
Member

hecrj commented May 1, 2020

@sum-elier Are you running in release mode?

We currently call view and redraw at every loop iteration, even if not necessary (see #241). CPU usage should decrease once we tackle that.

@sum-elier
Copy link
Contributor

@hecrj Yes, run --package todos --bin todos --release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants