-
Notifications
You must be signed in to change notification settings - Fork 346
Review Memory<T> architecture #952
Comments
Could you please add a disposable
|
@buybackoff would #944 meet those needs? In particular |
@benaadams Exactly, thanks! Haven't noticed that PR. |
Currently |
The reservation token cannot have Memory property because Memory is mutable. We would need to have R/O and R/W reservation tokens. |
Already in #944 as ReservedReadOnlyMemory |
@KrzysztofCwalina I have a question about the OwnedMemory class. protected internal virtual DisposableReservation Reserve(ref ReadOnlyMemory<T> memory)
{
return new DisposableReservation(this, Id);
} In this function, what is the purpose of It is passed as a parameter in public DisposableReservation Reserve()
{
return _owner.Reserve(ref this);
} |
The idea was that if you all Reserve on a small slice of large memory buffer, the implementation can copy just this small slice to a new buffer and return it in reserve. See https://github.com/dotnet/corefxlab/blob/master/tests/System.Slices.Tests/MemoryTests.cs#L105 But, I am not convinced we want this feature. @davidfowl was going to use it at some point, but I am not sure he does. |
It no longer needs to be part of |
This is no longer required according to the discussion in dotnet#952
This is no longer required according to the discussion in dotnet#952
This is no longer required according to the discussion in dotnet#952
* Remove access to Reference Count Do not allow direct access to the reference count, but instead query if it is zero or not. This is a precursor to allowing more efficient reference counting schemes. * Removed Reserve with ReadOnlyMemory ref This is no longer required according to the discussion in #952 * Made DisposableReservation return Spans We need DisposableReservations to be able to return Spans, so we can scope the access of the span. * Split disposal from pooling in Memory test. * Made ReferenceCounter methods static There is no instance state for the ReferenceCounter, so make all its methods static. * Enable switching modes for Reservations To enable testing different strategies for managing reservations, introduce a static variable that determines how reservations should be checked. * Added performance test for Reservations Added a simple performance test that allows a simple parameter sweep for number of threads, objects, and amount of work. This is not a very realistic example as it does not do the pipelining that is the key use case currently.
* Remove access to Reference Count Do not allow direct access to the reference count, but instead query if it is zero or not. This is a precursor to allowing more efficient reference counting schemes. * Removed Reserve with ReadOnlyMemory ref This is no longer required according to the discussion in dotnet#952 * Made DisposableReservation return Spans We need DisposableReservations to be able to return Spans, so we can scope the access of the span. * Split disposal from pooling in Memory test. * Made ReferenceCounter methods static There is no instance state for the ReferenceCounter, so make all its methods static. * Enable switching modes for Reservations To enable testing different strategies for managing reservations, introduce a static variable that determines how reservations should be checked. * Added performance test for Reservations Added a simple performance test that allows a simple parameter sweep for number of threads, objects, and amount of work. This is not a very realistic example as it does not do the pipelining that is the key use case currently.
closing as I think we settled on the architecture we want. |
Tracked by https://github.com/dotnet/corefx/issues/23863 |
Not a detailed design, but we should review general architecture of OwnedMemory, Memory, etc.
Here are the main points to discuss:
After the review, I will write down the spec.
The text was updated successfully, but these errors were encountered: