socketry / rspec-memory

MIT License
16 stars 7 forks source link

Fix slot size for non-64bit architectures #6

Closed dleidert closed 2 years ago

dleidert commented 2 years ago

Description

The slot sizes are different per architecture:

amd64: ruby -robjspace -e 'puts ObjectSpace.memsize_of(Object.new)' => 40

armhf: ruby -robjspace -e 'puts ObjectSpace.memsize_of(Object.new)' => 24

i386: ruby -robjspace -e 'puts ObjectSpace.memsize_of(Object.new)' => 20

However, the size in lib/rspec/memory/trace.rb is fix with the value of 40.

This led to test failures, as reported here: https://github.com/socketry/async-rspec/issues/16

Types of Changes

The idea is to expose the slot size dynamically instead of hard-coding it.

Testing

ioquatix commented 2 years ago

This looks good to me.

ioquatix commented 2 years ago

I released v1.0.3 with this PR. Thanks.