Skip to content

Fix a memory leak in components/script/script_runtime.rs and add more leak suppressions - #33175

Merged
mrobinson merged 3 commits into
servo:mainfrom
ede1998:fix-more-mem-leaks
Aug 26, 2024
Merged

mrobinson merged 3 commits into
servo:mainfrom
ede1998:fix-more-mem-leaks

Conversation

@ede1998

@ede1998 ede1998 commented Aug 24, 2024 •

Copy link
Copy Markdown
Contributor
  • More suppression for intentional leaks
  • Restored suppression for lazy_static leak as dependencies still use it
  • fix memory leak of Box<NetworkingTaskSource> by storing it inside Runtime instead of forgetting the raw pointer so that it gets dropped when the GC'ed Runtime is dropped

We only got leaks left now for https://example.com under Wayland. Some stuff with clipboard and so on (for details see the wayland leaks on this older stack trace: #32223 (comment)).

When running with XWayland (unset WAYLAND_DISPLAY), there are only leaks from libfontconfig.so left, which don't contain a full stack trace.

Direct leak of 512 byte(s) in 2 object(s) allocated from:
    #0 0x5c1875ec342f in malloc /rustc/llvm/src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:68:3
    #1 0x73eabd4df055  (/usr/lib/libfontconfig.so.1+0x21055) (BuildId: 6aec681ec5b2fb80f3a60e3cf3d75abac345c9b3)

Indirect leak of 64 byte(s) in 2 object(s) allocated from:
    #0 0x5c1875ec35f9 in calloc /rustc/llvm/src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:75:3
    #1 0x73eabd4e347d  (/usr/lib/libfontconfig.so.1+0x2547d) (BuildId: 6aec681ec5b2fb80f3a60e3cf3d75abac345c9b3)

Indirect leak of 22 byte(s) in 2 object(s) allocated from:
    #0 0x5c1875eab40a in strdup /rustc/llvm/src/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:570:3
    #1 0x73eabd4de8a8 in FcValueSave (/usr/lib/libfontconfig.so.1+0x208a8) (BuildId: 6aec681ec5b2fb80f3a60e3cf3d75abac345c9b3)

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix Leaks on example.com #32223 (GitHub issue number if applicable)
  • There are tests for these changes OR
  • These changes do not require tests because ___

lazy_static is still used by dependencies and still leaks
from static variables.

Signed-off-by: ede1998 <[email protected]>
@ede1998
ede1998 marked this pull request as ready for review August 24, 2024 20:12
@ede1998
ede1998 requested a review from gterzian as a code owner August 24, 2024 20:12
@mrobinson mrobinson changed the title Fix more mem leaks Fix a memory leak in components/script/script_runtime.rs and add more leak suppressions Aug 26, 2024
@mrobinson
mrobinson added this pull request to the merge queue Aug 26, 2024
Merged via the queue into servo:main with commit e5caa72 Aug 26, 2024
@ede1998
ede1998 deleted the fix-more-mem-leaks branch August 26, 2024 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Leaks on example.com

2 participants