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
- QueryInterceptorAttribute.cs
- DataBoundControlAdapter.cs
- SqlConnectionPoolProviderInfo.cs
- FontCacheLogic.cs
- SqlRemoveConstantOrderBy.cs
- FontStretch.cs
- ConfigurationException.cs
- CustomWebEventKey.cs
- DataTableMapping.cs
- HWStack.cs
- CFGGrammar.cs
- Geometry3D.cs
- DataControlCommands.cs
- Membership.cs
- PenContext.cs
- GPRECTF.cs
- GetCertificateRequest.cs
- EventSinkActivity.cs
- Axis.cs
- VirtualDirectoryMapping.cs
- EmptyControlCollection.cs
- PrinterResolution.cs
- IncomingWebRequestContext.cs
- AssemblyCache.cs
- ReadOnlyAttribute.cs
- OracleConnectionStringBuilder.cs
- StatusBar.cs
- DbConnectionStringBuilder.cs
- webclient.cs
- TaskFormBase.cs
- ContainerAction.cs
- ModuleBuilderData.cs
- BufferedWebEventProvider.cs
- Group.cs
- StorageModelBuildProvider.cs
- AlgoModule.cs
- EdgeModeValidation.cs
- ConnectionPool.cs
- SatelliteContractVersionAttribute.cs
- Byte.cs
- TemplateXamlParser.cs
- ResourceSet.cs
- MSAAWinEventWrap.cs
- MostlySingletonList.cs
- NativeRightsManagementAPIsStructures.cs
- SecurityHeader.cs
- Site.cs
- XmlSchemaObjectTable.cs
- DetailsView.cs
- OrthographicCamera.cs
- UnsafeNativeMethods.cs
- ListItemViewControl.cs
- TypeValidationEventArgs.cs
- Graphics.cs
- OverlappedAsyncResult.cs
- x509utils.cs
- Html32TextWriter.cs
- FormsAuthenticationModule.cs
- HMACRIPEMD160.cs
- SerialReceived.cs
- DataGridCommandEventArgs.cs
- complextypematerializer.cs
- ToolStripLabel.cs
- RadialGradientBrush.cs
- DataGrid.cs
- ButtonColumn.cs
- BamlTreeUpdater.cs
- NetPipeSection.cs
- PlaceHolder.cs
- StructuredTypeEmitter.cs
- ApplicationTrust.cs
- BulletedList.cs
- RequiredFieldValidator.cs
- ConsoleKeyInfo.cs
- MimeMultiPart.cs
- Tile.cs
- SliderAutomationPeer.cs
- UrlMappingsModule.cs
- Control.cs
- LogicalTreeHelper.cs
- MultiBinding.cs
- MenuItemBindingCollection.cs
- HttpServerChannel.cs
- TextCollapsingProperties.cs
- LocatorBase.cs
- SmiContextFactory.cs
- StateWorkerRequest.cs
- MenuAutoFormat.cs
- DESCryptoServiceProvider.cs
- SQLByte.cs
- DrawingBrush.cs
- ThreadStaticAttribute.cs
- ReferenceConverter.cs
- Visitors.cs
- RemotingConfigParser.cs
- ReadOnlyCollection.cs
- DataServiceQueryException.cs
- QilVisitor.cs
- UnsafeNativeMethods.cs
- DesignerDataStoredProcedure.cs