plasma-umass / Mesh

A memory allocator that automatically reduces the memory footprint of C/C++ applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segmentation fault on google-chrome

samuelgoto opened this issue · comments

These are some really amazing results you got on Firefox! I was trying to reproduce some of this in a fresh build of chrome (or any that may be installed) and got a segmentation fault.

Before I dig into this, I figure it would be smart to ask: is there any chance that you'd expect any of this to work on chrome? Or is there some architectural aspect of chrome that maybe would prevent some of this to work?

$ git clone --recurse-submodules https://github.com/plasma-umass/mesh
$ cd mesh
$ ./configure; make; sudo make install
# example: run git with mesh as its allocator:
$ LD_PRELOAD=libmesh.so google-chrome

Leads to

Segmentation fault

Ideas?

Hi @samuelgoto ! I think this is a duplicate of #25 -- both Firefox + Google Chrome by default bundle in their own allocator (jemalloc for FF, tcmalloc for Chrome), and mesh doesn't play well with this. In the paper, we built firefox with --disable-jemalloc to enable LD_PRELOADing mesh.

As this is now the second time this has come up, I would like to figure out some way to warn or error out earlier, so lets keep this issue open as a way to track this.

Ah interesting! I'm looking into some of the build time flags in chrome to see how to disable this (the equivalent of --disable-jemalloc).

Here are some hints that I'm looking at.

I'll report back what I find.

In the meantime, any tools handy to assess memory gains? How did you assess 16% memory gain in Firefox?

Just for my own recollection, here are a few things that I've tried but still run into a segfault.

// segfaults
gn gen out/Mesh --args='target_os="linux" use_goma=true use_allocator_shim=false'

and

// fails to build
gn gen out/Mesh --args='target_os="linux" use_goma=true use_allocator="none" use_allocator_shim=false'

gn gen out/Default --list shows two options I think you want to use together:

use_allocator
    Current value (from the default) = "tcmalloc"
      From //build/config/allocator.gni:28

    Memory allocator to use. Set to "none" to use default allocator.

use_allocator_shim
    Current value (from the default) = true
      From //build/config/allocator.gni:31

    Causes all the allocations to be routed via allocator_shim.cc.

so maybe:

use_allocator = "none"
use_allocator_shim = true

but -- I'm not sure how this interacts with Chrome's PartitionAlloc I think it uses internally for some things?

We developed and used this tool to record memory statistics reported in the paper:
https://github.com/bpowers/mstat

You can see an example of its usage here: https://github.com/plasma-umass/mesh-testsuite/blob/master/1-redis/test#L212 which is the test harness we used to run Redis as an LRU cache as described in the paper's evaluation

Oh I didn't see you explicitly said that my suggestion doesn't build -- sounds like a bug in the Chromium build system

I'm going to close this for now - if you get Chrome built in an LD_PRELOADable way and it issues with Mesh, definitely open a new issue!