Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Base / MS / Internal / IO / Packaging / TrackingMemoryStreamFactory.cs / 1 / 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
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BoundColumn.cs
- CompensatableSequenceActivity.cs
- RepeaterItemEventArgs.cs
- LogEntryUtils.cs
- FileEnumerator.cs
- TextBoxBase.cs
- DefaultProxySection.cs
- PasswordBox.cs
- HostProtectionPermission.cs
- PolyLineSegment.cs
- Menu.cs
- FileNotFoundException.cs
- FixedTextContainer.cs
- HttpServerVarsCollection.cs
- HwndHostAutomationPeer.cs
- AutomationPatternInfo.cs
- PrintController.cs
- DeferredTextReference.cs
- ValueTable.cs
- EventManager.cs
- AsymmetricSignatureFormatter.cs
- CodeTypeParameterCollection.cs
- ExpressionBuilderContext.cs
- TransactionFlowProperty.cs
- _HelperAsyncResults.cs
- TdsEnums.cs
- IndexerNameAttribute.cs
- ThicknessAnimationBase.cs
- WindowsScrollBarBits.cs
- EventProxy.cs
- CompoundFileDeflateTransform.cs
- IgnoreSection.cs
- ValidatorUtils.cs
- ChtmlImageAdapter.cs
- WindowsPrincipal.cs
- BufferModesCollection.cs
- XmlObjectSerializer.cs
- Queue.cs
- Timeline.cs
- VSWCFServiceContractGenerator.cs
- SplitterCancelEvent.cs
- ConfigurationElementProperty.cs
- SerializationException.cs
- _ShellExpression.cs
- ToolStripSystemRenderer.cs
- DSACryptoServiceProvider.cs
- TextWriter.cs
- ExpressionBinding.cs
- Events.cs
- SoapFormatter.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- NodeInfo.cs
- DisplayMemberTemplateSelector.cs
- CriticalFinalizerObject.cs
- MatrixCamera.cs
- AlphabetConverter.cs
- CodeMethodReturnStatement.cs
- ScriptingJsonSerializationSection.cs
- ClientTargetSection.cs
- mansign.cs
- ListView.cs
- PngBitmapEncoder.cs
- StringSource.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- ConfigurationSectionGroupCollection.cs
- AuthenticateEventArgs.cs
- IntellisenseTextBox.cs
- ObjectParameter.cs
- PeerNameRegistration.cs
- AdornerPresentationContext.cs
- RequestUriProcessor.cs
- KeyInterop.cs
- PointAnimationUsingKeyFrames.cs
- ColumnHeader.cs
- EditorBrowsableAttribute.cs
- COSERVERINFO.cs
- UIAgentMonitor.cs
- TagMapInfo.cs
- TemplateGroupCollection.cs
- InputManager.cs
- InvalidComObjectException.cs
- XpsPartBase.cs
- OutOfMemoryException.cs
- XhtmlConformanceSection.cs
- DoubleAnimationUsingKeyFrames.cs
- InkCanvasSelectionAdorner.cs
- XMLDiffLoader.cs
- StreamSecurityUpgradeAcceptorBase.cs
- RoutedEventValueSerializer.cs
- DragStartedEventArgs.cs
- CounterNameConverter.cs
- CharKeyFrameCollection.cs
- smtpconnection.cs
- XmlSerializerFactory.cs
- DataListItem.cs
- HuffModule.cs
- EntityConnection.cs
- ServerProtocol.cs
- RoleService.cs
- XmlSchemaInfo.cs