Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Only use pooled buffers #402

Closed
wants to merge 2 commits into from
Closed

Conversation

benaadams
Copy link
Contributor

Only use pooled blocks.
Don't finalize blocks outside debug.

For the cost of just including a finalizer on allocation see:
http://www.philosophicalgeek.com/2014/09/29/digging-into-net-object-allocation-fundamentals/

@@ -74,6 +74,9 @@ protected MemoryPoolBlock2()
/// </summary>
public MemoryPoolBlock2 Next { get; set; }

#if DEBUG
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should have a Debug.Assert for when Slab != null to ensure that we are always returning the block (in our tests at least).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also probably shouldn't add blocks that aren't pooled to the pool in Return

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed non-pooled blocks instead (from Lease)

@benaadams
Copy link
Contributor Author

Have something better

@benaadams benaadams changed the title Only finalize MemoryPoolBlock2 in debug Only use pooled buffers Nov 18, 2015
@benaadams
Copy link
Contributor Author

Revisit this later

@benaadams
Copy link
Contributor Author

Needs some revitalization...

@benaadams benaadams closed this Dec 4, 2015
@benaadams benaadams deleted the block-finalizer branch May 10, 2016 11:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants