Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- DataGridViewColumnCollection.cs
- RelatedPropertyManager.cs
- SqlDataSourceFilteringEventArgs.cs
- PenContext.cs
- SmiRecordBuffer.cs
- XmlQueryCardinality.cs
- WebZone.cs
- ObjectHandle.cs
- DeferredReference.cs
- EventDescriptor.cs
- SecurityListenerSettingsLifetimeManager.cs
- HorizontalAlignConverter.cs
- ObjectParameterCollection.cs
- NumericUpDownAccelerationCollection.cs
- ICspAsymmetricAlgorithm.cs
- CancellationHandlerDesigner.cs
- CreateRefExpr.cs
- DoubleLink.cs
- Int32Storage.cs
- MbpInfo.cs
- TextContainerChangeEventArgs.cs
- ThreadStartException.cs
- Vars.cs
- HtmlListAdapter.cs
- OutOfMemoryException.cs
- ChtmlTextWriter.cs
- DataServiceHost.cs
- HtmlContainerControl.cs
- ListViewCommandEventArgs.cs
- EdmProviderManifest.cs
- GridPattern.cs
- ValueType.cs
- Section.cs
- DropDownButton.cs
- SecurityContext.cs
- Span.cs
- ReturnValue.cs
- TypeDescriptionProviderAttribute.cs
- InputBindingCollection.cs
- PriorityQueue.cs
- GeometryDrawing.cs
- SyntaxCheck.cs
- Bold.cs
- ObjectKeyFrameCollection.cs
- HtmlTextArea.cs
- WsdlImporter.cs
- MimeMapping.cs
- EntityDesignerDataSourceView.cs
- DataViewSetting.cs
- ExpressionVisitor.cs
- RootDesignerSerializerAttribute.cs
- ErrorRuntimeConfig.cs
- Argument.cs
- MediaElementAutomationPeer.cs
- GridView.cs
- ReflectionTypeLoadException.cs
- ConfigurationValues.cs
- LineServicesRun.cs
- RangeValidator.cs
- MailFileEditor.cs
- XmlNodeChangedEventArgs.cs
- UIAgentAsyncEndRequest.cs
- ConfigurationSettings.cs
- EncoderParameters.cs
- Dictionary.cs
- DoubleStorage.cs
- WorkflowRuntimeEndpoint.cs
- TaiwanLunisolarCalendar.cs
- WebPartsPersonalizationAuthorization.cs
- MarkupCompilePass1.cs
- OdbcReferenceCollection.cs
- XmlAnyAttributeAttribute.cs
- Maps.cs
- UserControlAutomationPeer.cs
- EmptyElement.cs
- SqlDataReaderSmi.cs
- HttpRequestWrapper.cs
- XmlQualifiedName.cs
- SwitchElementsCollection.cs
- DeleteHelper.cs
- Geometry.cs
- DirectionalLight.cs
- ProfilePropertySettingsCollection.cs
- CallSiteHelpers.cs
- PropertyExpression.cs
- ReadOnlyDictionary.cs
- CacheSection.cs
- TextEffect.cs
- RelOps.cs
- RoleGroupCollection.cs
- CloudCollection.cs
- FrameworkContentElement.cs
- RootBrowserWindowProxy.cs
- _NestedMultipleAsyncResult.cs
- MaskInputRejectedEventArgs.cs
- LexicalChunk.cs
- EarlyBoundInfo.cs
- GridViewColumnCollection.cs
- DocumentXPathNavigator.cs