@@ -467,7 +467,7 @@ int ruby_gc_debug_indent = 0;
467
467
#endif
468
468
469
469
#ifndef CALC_EXACT_MALLOC_SIZE
470
- # define CALC_EXACT_MALLOC_SIZE USE_GC_MALLOC_OBJ_INFO_DETAILS
470
+ # define CALC_EXACT_MALLOC_SIZE 0
471
471
#endif
472
472
473
473
VALUE rb_mGC ;
@@ -4313,63 +4313,13 @@ rb_memerror(void)
4313
4313
EC_JUMP_TAG (ec , TAG_RAISE );
4314
4314
}
4315
4315
4316
- #if CALC_EXACT_MALLOC_SIZE && USE_GC_MALLOC_OBJ_INFO_DETAILS
4317
-
4318
- #define MALLOC_INFO_GEN_SIZE 100
4319
- #define MALLOC_INFO_SIZE_SIZE 10
4320
- static size_t malloc_info_gen_cnt [MALLOC_INFO_GEN_SIZE ];
4321
- static size_t malloc_info_gen_size [MALLOC_INFO_GEN_SIZE ];
4322
- static size_t malloc_info_size [MALLOC_INFO_SIZE_SIZE + 1 ];
4323
- static st_table * malloc_info_file_table ;
4324
-
4325
- static int
4326
- mmalloc_info_file_i (st_data_t key , st_data_t val , st_data_t dmy )
4327
- {
4328
- const char * file = (void * )key ;
4329
- const size_t * data = (void * )val ;
4330
-
4331
- fprintf (stderr , "%s\t%" PRIdSIZE "\t%" PRIdSIZE "\n" , file , data [0 ], data [1 ]);
4332
-
4333
- return ST_CONTINUE ;
4334
- }
4335
-
4336
- __attribute__((destructor ))
4337
- void
4338
- rb_malloc_info_show_results (void )
4339
- {
4340
- int i ;
4341
-
4342
- fprintf (stderr , "* malloc_info gen statistics\n" );
4343
- for (i = 0 ; i < MALLOC_INFO_GEN_SIZE ; i ++ ) {
4344
- if (i == MALLOC_INFO_GEN_SIZE - 1 ) {
4345
- fprintf (stderr , "more\t%" PRIdSIZE "\t%" PRIdSIZE "\n" , malloc_info_gen_cnt [i ], malloc_info_gen_size [i ]);
4346
- }
4347
- else {
4348
- fprintf (stderr , "%d\t%" PRIdSIZE "\t%" PRIdSIZE "\n" , i , malloc_info_gen_cnt [i ], malloc_info_gen_size [i ]);
4349
- }
4350
- }
4351
-
4352
- fprintf (stderr , "* malloc_info size statistics\n" );
4353
- for (i = 0 ; i < MALLOC_INFO_SIZE_SIZE ; i ++ ) {
4354
- int s = 16 << i ;
4355
- fprintf (stderr , "%d\t%" PRIdSIZE "\n" , s , malloc_info_size [i ]);
4356
- }
4357
- fprintf (stderr , "more\t%" PRIdSIZE "\n" , malloc_info_size [i ]);
4358
-
4359
- if (malloc_info_file_table ) {
4360
- fprintf (stderr , "* malloc_info file statistics\n" );
4361
- st_foreach (malloc_info_file_table , mmalloc_info_file_i , 0 );
4362
- }
4363
- }
4364
- #else
4365
4316
void
4366
4317
rb_malloc_info_show_results (void )
4367
4318
{
4368
4319
}
4369
- #endif
4370
4320
4371
4321
void *
4372
- ruby_xmalloc_body (size_t size )
4322
+ ruby_xmalloc (size_t size )
4373
4323
{
4374
4324
if ((ssize_t )size < 0 ) {
4375
4325
negative_size_allocation_error ("too large allocation size" );
@@ -4393,13 +4343,13 @@ xmalloc2_size(const size_t count, const size_t elsize)
4393
4343
}
4394
4344
4395
4345
void *
4396
- ruby_xmalloc2_body (size_t n , size_t size )
4346
+ ruby_xmalloc2 (size_t n , size_t size )
4397
4347
{
4398
4348
return rb_gc_impl_malloc (rb_gc_get_objspace (), xmalloc2_size (n , size ));
4399
4349
}
4400
4350
4401
4351
void *
4402
- ruby_xcalloc_body (size_t n , size_t size )
4352
+ ruby_xcalloc (size_t n , size_t size )
4403
4353
{
4404
4354
return rb_gc_impl_calloc (rb_gc_get_objspace (), xmalloc2_size (n , size ));
4405
4355
}
@@ -4418,7 +4368,7 @@ ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size)
4418
4368
}
4419
4369
4420
4370
void *
4421
- ruby_xrealloc_body (void * ptr , size_t new_size )
4371
+ ruby_xrealloc (void * ptr , size_t new_size )
4422
4372
{
4423
4373
return ruby_sized_xrealloc (ptr , new_size , 0 );
4424
4374
}
@@ -4434,7 +4384,7 @@ ruby_sized_xrealloc2(void *ptr, size_t n, size_t size, size_t old_n)
4434
4384
}
4435
4385
4436
4386
void *
4437
- ruby_xrealloc2_body (void * ptr , size_t n , size_t size )
4387
+ ruby_xrealloc2 (void * ptr , size_t n , size_t size )
4438
4388
{
4439
4389
return ruby_sized_xrealloc2 (ptr , n , size , 0 );
4440
4390
}
@@ -4519,11 +4469,6 @@ ruby_mimmalloc(size_t size)
4519
4469
{
4520
4470
struct malloc_obj_info * info = mem ;
4521
4471
info -> size = 0 ;
4522
- #if USE_GC_MALLOC_OBJ_INFO_DETAILS
4523
- info -> gen = 0 ;
4524
- info -> file = NULL ;
4525
- info -> line = 0 ;
4526
- #endif
4527
4472
mem = info + 1 ;
4528
4473
}
4529
4474
#endif
@@ -4549,11 +4494,6 @@ ruby_mimcalloc(size_t num, size_t size)
4549
4494
{
4550
4495
struct malloc_obj_info * info = mem ;
4551
4496
info -> size = 0 ;
4552
- #if USE_GC_MALLOC_OBJ_INFO_DETAILS
4553
- info -> gen = 0 ;
4554
- info -> file = NULL ;
4555
- info -> line = 0 ;
4556
- #endif
4557
4497
mem = info + 1 ;
4558
4498
}
4559
4499
#else
@@ -4673,69 +4613,3 @@ Init_GC(void)
4673
4613
4674
4614
rb_gc_impl_init ();
4675
4615
}
4676
-
4677
- #ifdef ruby_xmalloc
4678
- #undef ruby_xmalloc
4679
- #endif
4680
- #ifdef ruby_xmalloc2
4681
- #undef ruby_xmalloc2
4682
- #endif
4683
- #ifdef ruby_xcalloc
4684
- #undef ruby_xcalloc
4685
- #endif
4686
- #ifdef ruby_xrealloc
4687
- #undef ruby_xrealloc
4688
- #endif
4689
- #ifdef ruby_xrealloc2
4690
- #undef ruby_xrealloc2
4691
- #endif
4692
-
4693
- void *
4694
- ruby_xmalloc (size_t size )
4695
- {
4696
- #if USE_GC_MALLOC_OBJ_INFO_DETAILS
4697
- ruby_malloc_info_file = __FILE__ ;
4698
- ruby_malloc_info_line = __LINE__ ;
4699
- #endif
4700
- return ruby_xmalloc_body (size );
4701
- }
4702
-
4703
- void *
4704
- ruby_xmalloc2 (size_t n , size_t size )
4705
- {
4706
- #if USE_GC_MALLOC_OBJ_INFO_DETAILS
4707
- ruby_malloc_info_file = __FILE__ ;
4708
- ruby_malloc_info_line = __LINE__ ;
4709
- #endif
4710
- return ruby_xmalloc2_body (n , size );
4711
- }
4712
-
4713
- void *
4714
- ruby_xcalloc (size_t n , size_t size )
4715
- {
4716
- #if USE_GC_MALLOC_OBJ_INFO_DETAILS
4717
- ruby_malloc_info_file = __FILE__ ;
4718
- ruby_malloc_info_line = __LINE__ ;
4719
- #endif
4720
- return ruby_xcalloc_body (n , size );
4721
- }
4722
-
4723
- void *
4724
- ruby_xrealloc (void * ptr , size_t new_size )
4725
- {
4726
- #if USE_GC_MALLOC_OBJ_INFO_DETAILS
4727
- ruby_malloc_info_file = __FILE__ ;
4728
- ruby_malloc_info_line = __LINE__ ;
4729
- #endif
4730
- return ruby_xrealloc_body (ptr , new_size );
4731
- }
4732
-
4733
- void *
4734
- ruby_xrealloc2 (void * ptr , size_t n , size_t new_size )
4735
- {
4736
- #if USE_GC_MALLOC_OBJ_INFO_DETAILS
4737
- ruby_malloc_info_file = __FILE__ ;
4738
- ruby_malloc_info_line = __LINE__ ;
4739
- #endif
4740
- return ruby_xrealloc2_body (ptr , n , new_size );
4741
- }
0 commit comments