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

Cog memory leak #65

Closed
lilveg opened this issue Oct 11, 2018 · 6 comments
Closed

Cog memory leak #65

lilveg opened this issue Oct 11, 2018 · 6 comments
Labels
bug Something isn't working needs investigation Needs some investigation to find the cause of the issue

Comments

@lilveg
Copy link

lilveg commented Oct 11, 2018

Hello!

I am experiencing a memory leak in Cog. It's memory usage grows by about 25 MB/hour. The attached graph shows the available system memory along with with the memory consumed by Cog, WPEWebProcess and WPENetworkProcess individually, over a period of about 20 hours.

cog-memory

I am running a Qualcomm Snapdragon SD-410, with the latest Cog and WPE from meta-webkit as of yesterday (b12d42). This means commit 063df1 of Cog and version 2.22.0-r0 of WPEWebKit.

I am starting cog with these variables and arguments

[Service]
Environment=XDG_RUNTIME_DIR=/data/xdg_runtime_dir
Environment=COG_PLATFORM_FDO_VIEW_FULLSCREEN=1
Environment=WEBKIT_INSPECTOR_SERVER=0.0.0.0:2999
Environment=WPE_RAM_SIZE=128m
Environment=WPE_POLL_MAX_MEMORY=databaseprocess:50m,networkprocess:100m,webprocess:300m,rpcprocess:50m
Environment=MSE_MAX_BUFFER_SIZE=audio:2m,video:15m,text:1m
ExecStart=/usr/bin/cog -P fdo --enable-write-console-messages-to-stdout=true <url>

The page being displayed is of relatively low-resolution images scrolling horizontally using canvas, but the issue has also been observed when using css transforms.

Any help in finding the source of this problem is greatly appreciated!

@aperezdc aperezdc added bug Something isn't working needs investigation Needs some investigation to find the cause of the issue labels Oct 11, 2018
@aperezdc
Copy link
Member

aperezdc commented Oct 11, 2018

There's definitely something fishy going on here. Given that you are experiencing this when new frames are constantly being rendered and displayed (i.e. the image carousel, the transforms) what comes to my mind is something related to the code that runs on ever frame update.

Which resolution does your screen have, and how fast your animations are? I see from you graph that memory usage increases by 100 MiB in ~4 hours (that is: ~25 MiB/hour, ~420 KiB/minute, or ~7 KiB/second), so it does not look like buffers with rendered frames are being leaked (because for example a 960x540 screen in true color would take a bit inder 2 MiB per rendered frame) — but I would like to confirm my suspicion.

@lilveg
Copy link
Author

lilveg commented Oct 12, 2018

Hello Adrian,

The screen is 1280x1024. The canvas-based carousel runs at between 20 and 30 FPS, depending on how many images are on the screen.

@lilveg
Copy link
Author

lilveg commented Oct 15, 2018

I ran a test over the weekend, on the site that uses CSS transformations. Curiously, Cog consumes memory in a steep curve until it reaches 300 MB, then flattens out. This flattening corresponds with the system running very low on available memory, yet the fact that the memory consumption becomes so flat leads me to wonder if some kind of memory limit has been reached in Cog.

cog

Near the end of the graph, WPEWebProcss seems to crash, and the screen was blank this morning. I assume this happened to due lack of memory.

@aperezdc
Copy link
Member

A small leak was fixed in the FDO backend recently (see Igalia/WPEBackend-fdo#31), I wonder if it might be related 🤔

@lilveg Is there any chance you could re-run your test with the patch applied? Note that the fix is also available in the wpebackend-fdo-1.0 branch, which I think is the version you were (are?) probably using.

@aperezdc
Copy link
Member

I am going to close this issue for now, as it looks like the issue is gone—or at least nobody has been able to reproduce it anymore. If @lilveg or someone else can still hit the problem with current versions, we can always reopen this issue later 😺

@vnd
Copy link

vnd commented Sep 21, 2023

There's a memory leak during video playback with recent cog/wpewebkit on i.MX6DL platform:
WebPlatformForEmbedded/WPEWebKit#1191

(not sure which project is better suited for opening that issue, so just referencing it here)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs investigation Needs some investigation to find the cause of the issue
Projects
None yet
Development

No branches or pull requests

3 participants