Project

General

Profile

Actions

Feature #15667

closed

Introduce malloc_trim(0) in full gc cycles

Added by sam.saffron (Sam Saffron) about 5 years ago. Updated 3 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:91837]

Description

Per Hongli's excellent article it looks like malloc_trim can help tremendously with memory bloat issues.

https://www.joyfulbikeshedding.com/blog/2019-03-14-what-causes-ruby-memory-bloat.html#a-magic-trick-trimming

I would like to get this patch tested side-by-side at Discourse, GitHub and Shopify. If it looks good I think this is both a great candidate for 2.7 and and 2.4,2.5,2.6 backports.

Will coordinate with Shopify and GitHub to see if we can get numbers posted here, I will run tests on a live Discourse instance over the next week and report numbers here.

Koichi, what are your thoughts, to me this looks like an incredibly safe patch, the amount of work added to major GCs is tiny compared to the potential benefit, walking all pages is a very cheap operation.


Files

ruby_gc_malloc_trim.patch (1011 Bytes) ruby_gc_malloc_trim.patch mame (Yusuke Endoh), 03/20/2019 01:39 AM
Screenshot_2019-03-28 Grafana - Compare Discourse Perf.png (530 KB) Screenshot_2019-03-28 Grafana - Compare Discourse Perf.png sam.saffron (Sam Saffron), 03/28/2019 01:43 AM
crash.png (85.9 KB) crash.png sam.saffron (Sam Saffron), 04/01/2019 04:05 AM

Related issues 1 (1 open0 closed)

Related to Ruby master - Feature #14759: [PATCH] set M_ARENA_MAX for glibc mallocOpenActions
Actions

Also available in: Atom PDF

Like1
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0