Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / MS / Internal / IO / Packaging / TrackingMemoryStreamFactory.cs / 1305600 / TrackingMemoryStreamFactory.cs
//------------------------------------------------------------------------------ // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: // This is a basic implementation of the ITrackingMemoryStreamFactory interface // // History: // 07/4/2005: IgorBel: Initial creation. // 11/08/2005: BruceMac: Change namespace // //----------------------------------------------------------------------------- using System; using System.IO; using System.Diagnostics; namespace MS.Internal.IO.Packaging { ////// TrackingMemoryStreamFactory class is used in the Sparse Memory Stream to keep track of the memory Usage /// internal class TrackingMemoryStreamFactory : ITrackingMemoryStreamFactory { public MemoryStream Create() { return new TrackingMemoryStream((ITrackingMemoryStreamFactory)this); } public MemoryStream Create(int capacity) { return new TrackingMemoryStream((ITrackingMemoryStreamFactory)this, capacity); } public void ReportMemoryUsageDelta(int delta) { checked{_bufferedMemoryConsumption += delta;} Debug.Assert(_bufferedMemoryConsumption >=0, "we end up having buffers of negative size"); } internal long CurrentMemoryConsumption { get { return _bufferedMemoryConsumption; } } private long _bufferedMemoryConsumption; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: // This is a basic implementation of the ITrackingMemoryStreamFactory interface // // History: // 07/4/2005: IgorBel: Initial creation. // 11/08/2005: BruceMac: Change namespace // //----------------------------------------------------------------------------- using System; using System.IO; using System.Diagnostics; namespace MS.Internal.IO.Packaging { ////// TrackingMemoryStreamFactory class is used in the Sparse Memory Stream to keep track of the memory Usage /// internal class TrackingMemoryStreamFactory : ITrackingMemoryStreamFactory { public MemoryStream Create() { return new TrackingMemoryStream((ITrackingMemoryStreamFactory)this); } public MemoryStream Create(int capacity) { return new TrackingMemoryStream((ITrackingMemoryStreamFactory)this, capacity); } public void ReportMemoryUsageDelta(int delta) { checked{_bufferedMemoryConsumption += delta;} Debug.Assert(_bufferedMemoryConsumption >=0, "we end up having buffers of negative size"); } internal long CurrentMemoryConsumption { get { return _bufferedMemoryConsumption; } } private long _bufferedMemoryConsumption; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FutureFactory.cs
- OdbcTransaction.cs
- _NTAuthentication.cs
- TimeManager.cs
- XmlDocumentFieldSchema.cs
- OneOfConst.cs
- SignatureHelper.cs
- GridView.cs
- DbProviderConfigurationHandler.cs
- ServiceModelConfigurationSectionGroup.cs
- ColumnMapProcessor.cs
- HwndSourceParameters.cs
- AgileSafeNativeMemoryHandle.cs
- SemaphoreSecurity.cs
- RegexParser.cs
- HtmlImageAdapter.cs
- ResourceExpressionBuilder.cs
- XmlArrayAttribute.cs
- _ShellExpression.cs
- Sql8ConformanceChecker.cs
- Input.cs
- OleCmdHelper.cs
- ObjectViewListener.cs
- TaskFileService.cs
- Switch.cs
- SqlMethods.cs
- ReplyChannel.cs
- InstanceCreationEditor.cs
- PolyQuadraticBezierSegment.cs
- Config.cs
- DbTypeMap.cs
- FilterFactory.cs
- CodeObject.cs
- PermissionRequestEvidence.cs
- COM2Properties.cs
- Rotation3DKeyFrameCollection.cs
- RelationshipType.cs
- ActivityCollectionMarkupSerializer.cs
- OleDbRowUpdatingEvent.cs
- TextEditorMouse.cs
- SafeTimerHandle.cs
- Nullable.cs
- ColumnHeaderConverter.cs
- XPathScanner.cs
- WindowsIPAddress.cs
- TextContainerHelper.cs
- WebPartPersonalization.cs
- UserThread.cs
- UnsafeNativeMethodsPenimc.cs
- MsmqBindingElementBase.cs
- FontConverter.cs
- ZipIOFileItemStream.cs
- DispatchWrapper.cs
- StringValidator.cs
- bindurihelper.cs
- StringBuilder.cs
- ContentFileHelper.cs
- VirtualDirectoryMappingCollection.cs
- NavigationPropertyEmitter.cs
- XmlElementList.cs
- HtmlTableRowCollection.cs
- WorkerRequest.cs
- BitSet.cs
- XmlSchemaType.cs
- ObfuscateAssemblyAttribute.cs
- SqlDependency.cs
- RequestQueue.cs
- FileResponseElement.cs
- DropTarget.cs
- VectorValueSerializer.cs
- AddressAccessDeniedException.cs
- BaseCAMarshaler.cs
- SchemaObjectWriter.cs
- TimelineGroup.cs
- DateTimeConstantAttribute.cs
- TransactionTraceIdentifier.cs
- OracleDateTime.cs
- DataGridLinkButton.cs
- BitmapEffectGroup.cs
- OleDbException.cs
- VirtualDirectoryMapping.cs
- SelectionProviderWrapper.cs
- WebPartConnectionsCancelVerb.cs
- WebPartPersonalization.cs
- OuterGlowBitmapEffect.cs
- TextView.cs
- ArraySortHelper.cs
- DataControlFieldHeaderCell.cs
- ComplusEndpointConfigContainer.cs
- SignatureHelper.cs
- RemoveStoryboard.cs
- ColorBlend.cs
- EllipticalNodeOperations.cs
- ClientConfigurationSystem.cs
- SimpleRecyclingCache.cs
- QueryGeneratorBase.cs
- GraphicsPathIterator.cs
- HttpCookiesSection.cs
- LogicalTreeHelper.cs
- PrintPreviewControl.cs