tfzxyinhao / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

max memory setting #448

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
when running in a shared environment with enforced resource (memory) 
constraints would be great if we could pass a --max_memory flag to tcmalloc and 
it would tweak it's freelist and GC behavior based on the flag and how much 
memory it is using to stay under that limit.

Original issue reported on code.google.com by ice...@google.com on 12 Jul 2012 at 7:36

GoogleCodeExporter commented 9 years ago
I had the same thought.

I imagine that when we hit memory limit PageHeap::IncrementalScavenge should be 
pushed forward (and if there is nothing more to Scavenge then call new_handler).

My current problem with IncrementalScavenge is that it's capable to return 
unused memory to the system, but it's too difficult to control.

Original comment by pafi...@gmail.com on 23 Aug 2012 at 9:40

GoogleCodeExporter commented 9 years ago
Here you go. Not very stress tested yet, but unittest passes.
You can control it by TCMALLOC_HEAP_LIMIT_MB env variable (see description in 
the patch).

Original comment by pafi...@gmail.com on 1 Sep 2012 at 1:15

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Updated patch with unittests fixes + comments and indentation changes.
TCMALLOC_DISABLE_MEMORY_RELEASE switch added to emulate platform with no 
MADV_DONTNEED support (for testing purposes).

Original comment by pafi...@gmail.com on 2 Sep 2012 at 9:31

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by chapp...@gmail.com on 3 Nov 2012 at 4:56

GoogleCodeExporter commented 9 years ago
r178 | chappedm@gmail.com | 2012-11-04 14:02:15 -0500 (Sun, 04 Nov 2012) | 5 
lines

issue-448: New environment setting that allows you to set an explicit heap limit

TCMALLOC_HEAP_LIMIT_MB - The maximum amount of heap memory that tcmalloc can 
use.
TCMALLOC_DISABLE_MEMORY_RELEASE - emulate platform with no MADV_DONTNEED 
support (generally for testing purposes).

Original comment by chapp...@gmail.com on 4 Nov 2012 at 7:02