From 0fa71d44d505daf60bf8d4539ef4548207ba4002 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 13 Nov 2018 04:29:31 +0000 Subject: date_core.c: respect COMPLEX_DAT bit * ext/date/date_core.c (d_lite_marshal_load): respect COMPLEX_DAT bit in the pre-allocated structure. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/date/test_date_marshal.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/date/test_date_marshal.rb b/test/date/test_date_marshal.rb index 24622bd4b9..c7ce737aac 100644 --- a/test/date/test_date_marshal.rb +++ b/test/date/test_date_marshal.rb @@ -41,4 +41,12 @@ class TestDateMarshal < Test::Unit::TestCase assert_raise(expected_error){d.marshal_load(a)} end + def test_memsize + require 'objspace' + t = DateTime.new(2018, 11, 13) + size = ObjectSpace.memsize_of(t) + t2 = Marshal.load(Marshal.dump(t)) + assert_equal(t, t2) + assert_equal(size, ObjectSpace.memsize_of(t2), "not reallocated but memsize changed") + end end -- cgit v1.2.3