[ruby-cvs:60539] normal:r53376 (trunk): use id_table for constant tables

normal at ruby-lang.org normal at ruby-lang.org
Wed Dec 30 05:19:16 JST 2015


normal	2015-12-30 05:19:14 +0900 (Wed, 30 Dec 2015)

  New Revision: 53376

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53376

  Log:
    use id_table for constant tables
    
    valgrind 3.9.0 on x86-64 reports a minor reduction in memory usage
    when loading only RubyGems and RDoc by running: ruby -rrdoc -eexit
    
    before: HEAP SUMMARY:
        in use at exit: 2,913,448 bytes in 27,394 blocks
      total heap usage: 48,362 allocs, 20,968 frees, 9,034,621 bytes alloc
    
    after: HEAP SUMMARY:
        in use at exit: 2,880,056 bytes in 26,712 blocks
      total heap usage: 47,791 allocs, 21,079 frees, 9,046,507 bytes alloc
    
    * class.c (struct clone_const_arg): adjust for id_table
      (clone_const): ditto
      (clone_const_i): ditto
      (rb_mod_init_copy): ditto
      (rb_singleton_class_clone_and_attach): ditto
      (rb_include_class_new): ditto
      (include_modules_at): ditto
    * constant.h (rb_free_const_table): ditto
    * gc.c (free_const_entry_i): ditto
      (rb_free_const_table): ditto
      (obj_memsize_of): ditto
      (mark_const_entry_i): ditto
      (mark_const_tbl): ditto
    * internal.h (struct rb_classext_struct): ditto
    * object.c (rb_mod_const_set): resolve class name on assignment
    * variable.c (const_update): replace with const_tbl_update
      (const_tbl_update): new function
      (fc_i): adjust for id_table
      (find_class_path): ditto
      (autoload_const_set): st_update => const_tbl_update
      (rb_const_remove): adjust for id_table
      (sv_i): ditto
      (rb_local_constants_i): ditto
      (rb_local_constants): ditto
      (rb_mod_const_at): ditto
      (rb_mod_const_set): ditto
      (rb_const_lookup): ditto

  Modified files:
    trunk/class.c
    trunk/constant.h
    trunk/gc.c
    trunk/internal.h
    trunk/object.c
    trunk/variable.c


More information about the ruby-cvs mailing list