Run Code | API | Code Wall | Misc | Feedback | Login | Theme | Privacy | Patreon |
Memory_testSize of char : 1 Size of int : 4 Size of double : 8 ------------------------------- size of Fruit is 32 size of Apple is 40 ------------------------------- 测试输出最原始结构 the memory of Fruit--------------------- Address of Fruit: 0x 0x7ffd78bf4e20 | Size = 32 60 2b 40 00 00 00 00 00 c0 14 63 27 05 7f 00 00 80 4f bf 78 fd 7f 00 00 78 0b 60 27 05 7f 00 00 ------------------------------- the memory of Apple--------------------- Address of Apple: 0x 0x7ffd78bf4fa0 | Size = 40 78 2b 40 00 00 00 00 00 e8 19 ab 26 05 7f 00 00 50 51 bf 78 fd 7f 00 00 53 17 42 27 05 7f 00 00 00 00 00 00 00 00 00 00 ------------------------------- 去掉虚函数后的定义 the memory of Fruit1--------------------- Address of Fruit1: 0x 0x7ffd78bf4d60 | Size = 24 2f 03 00 00 00 00 00 00 f8 9f ab 26 05 7f 00 00 00 00 60 27 05 7f 00 00 ------------------------------- the memory of Apple1--------------------- Address of Apple1: 0x 0x7ffd78bf4e40 | Size = 32 00 00 00 00 00 00 00 00 68 11 63 27 05 7f 00 00 a8 4f bf 78 fd 7f 00 00 4f 49 41 27 05 7f 00 00 ------------------------------- 添加构造函数后的定义 the memory of Fruit2--------------------- Address of Fruit2: 0x 0x7ffd78bf4e60 | Size = 32 90 2b 40 00 00 00 00 00 01 00 00 00 05 7f 00 00 c3 f5 28 5c 8f c2 02 40 63 00 00 00 00 00 00 00 ------------------------------- the memory of Apple2--------------------- Address of Apple2: 0x 0x7ffd78bf4fd0 | Size = 40 a8 2b 40 00 00 00 00 00 01 00 00 00 00 00 00 00 c3 f5 28 5c 8f c2 02 40 63 00 00 00 09 00 00 00 64 00 00 00 00 00 00 00 ------------------------------- 父类子类虚函数不同名的情况 the memory of Fruit3--------------------- Address of Fruit3: 0x 0x7ffd78bf4e80 | Size = 32 c0 2b 40 00 00 00 00 00 01 00 00 00 05 7f 00 00 d9 ce f7 53 e3 a5 0b 40 63 e4 62 27 05 7f 00 00 ------------------------------- the memory of Apple3--------------------- Address of Apple3: 0x 0x7ffd78bf5000 | Size = 40 d8 2b 40 00 00 00 00 00 01 00 00 00 00 00 00 00 d9 ce f7 53 e3 a5 0b 40 63 00 00 00 09 00 00 00 64 00 00 00 00 00 00 00 ------------------------------- 定义顺序调整(虚函数同名)(优化后) the memory of Fruit4--------------------- Address of Fruit4: 0x 0x7ffd78bf4d80 | Size = 24 f8 2b 40 00 00 00 00 00 63 3e 41 27 01 00 00 00 6d e7 fb a9 f1 d2 11 40 ------------------------------- the memory of Apple4--------------------- Address of Apple4: 0x 0x7ffd78bf4ea0 | Size = 32 10 2c 40 00 00 00 00 00 63 00 00 00 01 00 00 00 6d e7 fb a9 f1 d2 11 40 64 4e bf 78 09 00 00 00 ------------------------------- 纯虚函数是否影响 the memory of Fruit5--------------------- Address of Fruit5: 0x 0 | Size = 32 Null pointer exception ------------------------------- the memory of Apple5--------------------- Address of Apple5: 0x 0x7ffd78bf5030 | Size = 40 28 2c 40 00 00 00 00 00 01 00 00 00 00 00 00 00 d3 4d 62 10 58 39 16 40 63 00 00 ff 09 00 00 00 64 00 00 00 00 00 00 00 ------------------------------- 测试元素分布 the memory of Fruit21--------------------- Address of Fruit21: 0x 0x7ffd78bf4ec0 | Size = 32 90 2b 40 00 00 00 00 00 01 00 00 00 fd 7f 00 00 c3 f5 28 5c 8f c2 02 40 63 09 40 00 00 00 00 00 ------------------------------- the memory of Fruit22--------------------- Address of Fruit22: 0x 0x7ffd78bf4ee0 | Size = 32 90 2b 40 00 00 00 00 00 03 00 00 00 05 7f 00 00 c3 f5 28 5c 8f c2 02 40 62 00 60 27 05 7f 00 00 ------------------------------- the memory of Apple21--------------------- Address of Apple21: 0x 0x7ffd78bf5060 | Size = 40 a8 2b 40 00 00 00 00 00 02 00 00 00 00 00 00 00 0e 2d b2 9d ef 27 1b 40 65 00 00 00 09 00 00 00 64 00 00 00 00 00 00 00 ------------------------------- the memory of Apple21--------------------- Address of Apple21: 0x 0x7ffd78bf5090 | Size = 40 a8 2b 40 00 00 00 00 00 03 00 00 00 00 00 00 00 0e 2d b2 9d ef 27 1b 40 66 00 00 00 08 00 00 00 61 00 00 00 00 00 00 00 ------------------------------- the memory of Fruit41--------------------- Address of Fruit41: 0x 0x7ffd78bf4da0 | Size = 24 f8 2b 40 00 00 00 00 00 63 4e bf 78 01 00 00 00 da 1b 7c 61 32 b5 44 40 ------------------------------- the memory of Fruit42--------------------- Address of Fruit42: 0x 0x7ffd78bf4dc0 | Size = 24 f8 2b 40 00 00 00 00 00 62 4e bf 78 02 00 00 00 da 1b 7c 61 32 b5 44 40 ------------------------------- the memory of Apple41--------------------- Address of Apple41: 0x 0x7ffd78bf4f00 | Size = 32 10 2c 40 00 00 00 00 00 63 98 41 27 01 00 00 00 da 1b 7c 61 32 b5 44 40 64 00 00 00 09 00 00 00 ------------------------------- the memory of Apple42--------------------- Address of Apple42: 0x 0x7ffd78bf4f20 | Size = 32 10 2c 40 00 00 00 00 00 67 e3 0a 27 01 00 00 00 da 1b 7c 61 32 b5 44 40 65 17 42 27 08 00 00 00 ------------------------------- 测试虚函数的大小 the memory of Fruit6--------------------- Address of Fruit6: 0x 0x7ffd78bf4d20 | Size = 8 40 2c 40 00 00 00 00 00 ------------------------------- the memory of Apple6--------------------- Address of Apple6: 0x 0x7ffd78bf4d30 | Size = 8 58 2c 40 00 00 00 00 00 ------------------------------- 验证虚函数和对齐 the memory of Fruit7--------------------- Address of Fruit7: 0x 0x7ffd78bf4d40 | Size = 16 70 2c 40 00 00 00 00 00 61 cd aa 26 05 7f 00 00 ------------------------------- the memory of Apple7--------------------- Address of Apple7: 0x 0x7ffd78bf4d50 | Size = 16 88 2c 40 00 00 00 00 00 62 63 41 27 05 7f 00 00 ------------------------------- 测试定义顺序对内存的影响 the memory of Fruit8--------------------- Address of Fruit8: 0x 0x7ffd78bf4de0 | Size = 24 a0 2c 40 00 00 00 00 00 e0 4e bf 78 fd 7f 00 00 b8 0a 60 27 05 7f 00 00 ------------------------------- the memory of Apple8--------------------- Address of Apple8: 0x 0x7ffd78bf4f40 | Size = 32 b8 2c 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 40 60 00 00 00 00 00 ------------------------------- the memory of Fruit9--------------------- Address of Fruit9: 0x 0x7ffd78bf4e00 | Size = 24 d0 2c 40 00 00 00 00 00 61 62 62 27 01 00 00 00 58 39 b4 c8 76 be f3 3f ------------------------------- the memory of Apple9--------------------- Address of Apple9: 0x 0x7ffd78bf4f60 | Size = 32 e8 2c 40 00 00 00 00 00 61 62 bf 78 01 00 00 00 58 39 b4 c8 76 be f3 3f 63 00 00 00 02 00 00 00 ------------------------------- 多个虚函数测试,对齐情况 the memory of Fruit10--------------------- Address of Fruit10: 0x 0x7ffd78bf4f80 | Size = 32 00 2d 40 00 00 00 00 00 0a 00 00 00 05 7f 00 00 00 00 00 00 00 c0 58 40 01 00 00 00 00 00 00 00 ------------------------------- the memory of Apple10--------------------- Address of Apple10: 0x 0x7ffd78bf50c0 | Size = 40 28 2d 40 00 00 00 00 00 0a 00 00 00 05 7f 00 00 00 00 00 00 00 c0 58 40 01 cd 17 27 64 00 00 00 09 6a 40 27 05 7f 00 00 ------------------------------- |
λ
.NET NoSQL database for rapid development
|