aboutsummaryrefslogtreecommitdiff
path: root/gcc/memory-block.h
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2019-11-22 15:37:37 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2019-11-22 14:37:37 +0000
commit9fd052e775623581d2d277a1688b9fde94cb18d2 (patch)
tree7f4801c5d1bcb5f9fda27cdbfe254577322eeec0 /gcc/memory-block.h
parentf2f3dbc67b85af0f1b6c6feb529a67baf011939c (diff)
downloadgcc-9fd052e775623581d2d277a1688b9fde94cb18d2.zip
gcc-9fd052e775623581d2d277a1688b9fde94cb18d2.tar.gz
gcc-9fd052e775623581d2d277a1688b9fde94cb18d2.tar.bz2
Release memory-block-pool memory back to malloc.
* ggc-page.c (ggc_collect): Call memory_block_pool::trim. * memory-block.cc (memory_block_pool::clear_free_list): Rename to ... (memory_block_pool::reduce_free_list): ... this one. (memory_block_pool::trim): New static function. * memory-block.h (memory_block_pool::freelist_size): New constant (memory_block_pool::clear_free_list): Rename to ... (memory_block_pool::reduce_free_list): ... this one. (memory_block_pool::trim): Declare. * lto.c (lto_wpa_write_files): Call memory_block_pool::trim. From-SVN: r278616
Diffstat (limited to 'gcc/memory-block.h')
-rw-r--r--gcc/memory-block.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/memory-block.h b/gcc/memory-block.h
index 8ebeee0..a11465b 100644
--- a/gcc/memory-block.h
+++ b/gcc/memory-block.h
@@ -28,12 +28,15 @@ class memory_block_pool
public:
/* Blocks have fixed size. This is necessary for sharing. */
static const size_t block_size = 64 * 1024;
+ /* Number of blocks we keep in the freelists. */
+ static const size_t freelist_size = 1024 * 1024 / block_size;
memory_block_pool ();
static inline void *allocate () ATTRIBUTE_MALLOC;
static inline void release (void *);
- void clear_free_list ();
+ static void trim (int nblocks = freelist_size);
+ void reduce_free_list (int);
private:
/* memory_block_pool singleton instance, defined in memory-block.cc. */