Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- TickBar.cs
- UnmanagedHandle.cs
- ResourcePermissionBase.cs
- EditorZone.cs
- XmlSchemaComplexType.cs
- SystemResources.cs
- AddInAttribute.cs
- X500Name.cs
- SafeHandle.cs
- SQLDoubleStorage.cs
- XPathExpr.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- FileInfo.cs
- ObjectListItemCollection.cs
- EntityDataSourceReferenceGroup.cs
- ConnectionStringSettingsCollection.cs
- UserControl.cs
- Size3DValueSerializer.cs
- CompilerTypeWithParams.cs
- OleDbEnumerator.cs
- NumericPagerField.cs
- TextDecoration.cs
- HwndKeyboardInputProvider.cs
- SQLSingle.cs
- SqlExpressionNullability.cs
- ParserOptions.cs
- Camera.cs
- UpdateCommandGenerator.cs
- AssemblyBuilder.cs
- InvalidOleVariantTypeException.cs
- FixedSOMPageConstructor.cs
- XamlToRtfWriter.cs
- HwndAppCommandInputProvider.cs
- UTF8Encoding.cs
- documentsequencetextpointer.cs
- List.cs
- CompilerTypeWithParams.cs
- ItemCheckEvent.cs
- sqlstateclientmanager.cs
- RouteData.cs
- DrawingDrawingContext.cs
- NameValueCache.cs
- IUnknownConstantAttribute.cs
- SqlDataSourceSelectingEventArgs.cs
- InvokeWebServiceDesigner.cs
- ObjectMaterializedEventArgs.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- XPathDocumentIterator.cs
- FormsAuthenticationUser.cs
- codemethodreferenceexpression.cs
- SoapUnknownHeader.cs
- WebConfigurationHostFileChange.cs
- Crc32Helper.cs
- EncodingTable.cs
- CommandHelpers.cs
- StandardToolWindows.cs
- XmlSchemaSequence.cs
- StyleXamlTreeBuilder.cs
- SystemNetHelpers.cs
- _NTAuthentication.cs
- MexTcpBindingCollectionElement.cs
- CompositeFontFamily.cs
- ImageBrush.cs
- ContentTextAutomationPeer.cs
- DurableTimerExtension.cs
- Int32CAMarshaler.cs
- XmlCharType.cs
- DESCryptoServiceProvider.cs
- EventlogProvider.cs
- SqlBulkCopyColumnMapping.cs
- DoWhileDesigner.xaml.cs
- ViewPort3D.cs
- ProfileInfo.cs
- TextParentUndoUnit.cs
- TerminateDesigner.cs
- ScrollData.cs
- EntityTypeEmitter.cs
- XmlNode.cs
- TextElement.cs
- OleCmdHelper.cs
- UserControlBuildProvider.cs
- GeometryCombineModeValidation.cs
- PerformanceCounterPermission.cs
- ObjectAnimationUsingKeyFrames.cs
- TextBoxBase.cs
- RegistryKey.cs
- MobileControlDesigner.cs
- XamlBuildProvider.cs
- DispatcherTimer.cs
- _AuthenticationState.cs
- Base64Decoder.cs
- TemplateControlBuildProvider.cs
- DtrList.cs
- CryptoApi.cs
- DocumentXPathNavigator.cs
- ColumnResizeUndoUnit.cs
- PageCache.cs
- TcpTransportElement.cs
- AnnotationResourceCollection.cs
- ClientUtils.cs