aboutsummaryrefslogtreecommitdiffstats
path: root/gc
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2024-07-11 04:45:10 +0200
committer卜部昌平 <shyouhei@ruby-lang.org>2024-07-12 10:21:07 +0900
commitfa6bf1da576430c1db0ff1d68fb9b5992a1d71c8 (patch)
treeecc40496c480b8a76c67fe9b95152666839a4187 /gc
parent9acc0efdc158111f2e5737ba9f51caaf491abf51 (diff)
downloadruby-fa6bf1da576430c1db0ff1d68fb9b5992a1d71c8.tar.gz
give up USE_GC_MALLOC_OBJ_INFO_DETAILS
This feature is no longer possible under current design; now that our GC is pluggable, we cannot assume what was achieved by this compiler flag is always possble by the dynamically-loaded GC implementation.
Diffstat (limited to 'gc')
-rw-r--r--gc/default.c69
1 files changed, 1 insertions, 68 deletions
diff --git a/gc/default.c b/gc/default.c
index 0ed3ba7478..405b9dc4a7 100644
--- a/gc/default.c
+++ b/gc/default.c
@@ -319,7 +319,7 @@ int ruby_rgengc_debug;
# define GC_ENABLE_LAZY_SWEEP 1
#endif
#ifndef CALC_EXACT_MALLOC_SIZE
-# define CALC_EXACT_MALLOC_SIZE USE_GC_MALLOC_OBJ_INFO_DETAILS
+# define CALC_EXACT_MALLOC_SIZE 0
#endif
#if defined(HAVE_MALLOC_USABLE_SIZE) || CALC_EXACT_MALLOC_SIZE > 0
# ifndef MALLOC_ALLOCATED_SIZE
@@ -8360,18 +8360,8 @@ objspace_malloc_increase_body(rb_objspace_t *objspace, void *mem, size_t new_siz
struct malloc_obj_info { /* 4 words */
size_t size;
-#if USE_GC_MALLOC_OBJ_INFO_DETAILS
- size_t gen;
- const char *file;
- size_t line;
-#endif
};
-#if USE_GC_MALLOC_OBJ_INFO_DETAILS
-const char *ruby_malloc_info_file;
-int ruby_malloc_info_line;
-#endif
-
static inline size_t
objspace_malloc_prepare(rb_objspace_t *objspace, size_t size)
{
@@ -8404,11 +8394,6 @@ objspace_malloc_fixup(rb_objspace_t *objspace, void *mem, size_t size)
{
struct malloc_obj_info *info = mem;
info->size = size;
-#if USE_GC_MALLOC_OBJ_INFO_DETAILS
- info->gen = objspace->profile.count;
- info->file = ruby_malloc_info_file;
- info->line = info->file ? ruby_malloc_info_line : 0;
-#endif
mem = info + 1;
}
#endif
@@ -8478,58 +8463,6 @@ rb_gc_impl_free(void *objspace_ptr, void *ptr, size_t old_size)
struct malloc_obj_info *info = (struct malloc_obj_info *)ptr - 1;
ptr = info;
old_size = info->size;
-
-#if USE_GC_MALLOC_OBJ_INFO_DETAILS
- {
- int gen = (int)(objspace->profile.count - info->gen);
- int gen_index = gen >= MALLOC_INFO_GEN_SIZE ? MALLOC_INFO_GEN_SIZE-1 : gen;
- int i;
-
- malloc_info_gen_cnt[gen_index]++;
- malloc_info_gen_size[gen_index] += info->size;
-
- for (i=0; i<MALLOC_INFO_SIZE_SIZE; i++) {
- size_t s = 16 << i;
- if (info->size <= s) {
- malloc_info_size[i]++;
- goto found;
- }
- }
- malloc_info_size[i]++;
- found:;
-
- {
- st_data_t key = (st_data_t)info->file, d;
- size_t *data;
-
- if (malloc_info_file_table == NULL) {
- malloc_info_file_table = st_init_numtable_with_size(1024);
- }
- if (st_lookup(malloc_info_file_table, key, &d)) {
- /* hit */
- data = (size_t *)d;
- }
- else {
- data = malloc(xmalloc2_size(2, sizeof(size_t)));
- if (data == NULL) rb_bug("objspace_xfree: can not allocate memory");
- data[0] = data[1] = 0;
- st_insert(malloc_info_file_table, key, (st_data_t)data);
- }
- data[0] ++;
- data[1] += info->size;
- };
- if (0 && gen >= 2) { /* verbose output */
- if (info->file) {
- fprintf(stderr, "free - size:%"PRIdSIZE", gen:%d, pos: %s:%"PRIdSIZE"\n",
- info->size, gen, info->file, info->line);
- }
- else {
- fprintf(stderr, "free - size:%"PRIdSIZE", gen:%d\n",
- info->size, gen);
- }
- }
- }
-#endif
#endif
old_size = objspace_malloc_size(objspace, ptr, old_size);