Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify small and medium blocks. #5071

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Unify small and medium blocks. #5071

wants to merge 1 commit into from

Conversation

atulkatti
Copy link
Contributor

@atulkatti atulkatti commented Apr 30, 2018

This unifies the small and medium block types. After this change we will have only small and large blocks. Any objects of size less than or equal to 3584 bytes will fall in the small buckets. All the objects larger than that will be allocated in large buckets. In future, we may reduce the size of objects that fall into the small bucket even further.

The alignment of objects in the small bucket is based on the actual size of the objects. Currently, this is setup as follows and can be tweaked if needed:
SizeCat <= 768 bytes are aligned to 16 bytes
SizeCat <= 1024 bytes are aligned to 32 bytes
SizeCat <= 1536 bytes are aligned to 64 bytes
SizeCat <= 2560 bytes are aligned to 128 bytes
SizeCat <= 3584 bytes are aligned to 256 bytes

@leirocks
Copy link
Contributor

template <ObjectInfoBits attributes, bool isSmallAlloc, bool nothrow>

remove this?


Refers to: lib/Common/Memory/Recycler.inl:288 in 86ecfcc. [](commit_id = 86ecfcc, deletion_comment = False)

@@ -563,6 +570,20 @@ SmallHeapBlockT<TBlockAttributes>::GetObjectBitDelta()
return this->objectSize / HeapConstants::ObjectGranularity;
}

template <class TBlockAttributes>
__forceinline ushort
SmallHeapBlockT<TBlockAttributes>::GetAddressBitIndex(void * objectAddress, uint bucketIndex)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bucketIndex [](start = 81, length = 11)

not used?

4 64 8
8 128 8
16 256 4
Total # of Buckets: 76
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks fine. Have you measure what the memory impact is? Is there any other perf impact?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants