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
- XmlElement.cs
- QueryBranchOp.cs
- ApplicationInterop.cs
- QueryConverter.cs
- SiteMapDataSourceView.cs
- SoapElementAttribute.cs
- ShowExpandedMultiValueConverter.cs
- RTLAwareMessageBox.cs
- DataServiceOperationContext.cs
- StateChangeEvent.cs
- MetadataArtifactLoaderCompositeFile.cs
- DataChangedEventManager.cs
- Application.cs
- listitem.cs
- DataSourceCacheDurationConverter.cs
- XmlSerializerNamespaces.cs
- VSWCFServiceContractGenerator.cs
- BinaryMessageEncodingBindingElement.cs
- TableLayoutCellPaintEventArgs.cs
- embossbitmapeffect.cs
- CodeSnippetTypeMember.cs
- GeneralTransformGroup.cs
- CharUnicodeInfo.cs
- HttpDebugHandler.cs
- ZipIOCentralDirectoryFileHeader.cs
- TransformedBitmap.cs
- Path.cs
- MenuAdapter.cs
- MonitoringDescriptionAttribute.cs
- FontUnitConverter.cs
- UnhandledExceptionEventArgs.cs
- ComplexBindingPropertiesAttribute.cs
- UriTemplate.cs
- RecipientInfo.cs
- Menu.cs
- ControlBuilderAttribute.cs
- ScriptControlManager.cs
- IListConverters.cs
- ApplicationServicesHostFactory.cs
- WebScriptClientGenerator.cs
- PageThemeCodeDomTreeGenerator.cs
- PixelFormat.cs
- VirtualizingStackPanel.cs
- Operand.cs
- NameNode.cs
- MappedMetaModel.cs
- ConfigurationPropertyAttribute.cs
- DataRecord.cs
- ReadOnlyCollectionBase.cs
- PanelStyle.cs
- BigInt.cs
- RoleGroupCollection.cs
- processwaithandle.cs
- ListControl.cs
- HttpDebugHandler.cs
- ContainsSearchOperator.cs
- ExpressionList.cs
- DataTransferEventArgs.cs
- SoapMessage.cs
- ListViewUpdatedEventArgs.cs
- HandleRef.cs
- KeyBinding.cs
- DiscoveryServiceExtension.cs
- SimpleApplicationHost.cs
- DispatchOperation.cs
- CompilerErrorCollection.cs
- GridViewColumnCollectionChangedEventArgs.cs
- ConfigXmlCDataSection.cs
- EventlogProvider.cs
- DropTarget.cs
- TableCell.cs
- ChildDocumentBlock.cs
- DiscardableAttribute.cs
- CompositeActivityTypeDescriptor.cs
- BufferedReceiveElement.cs
- XhtmlBasicValidatorAdapter.cs
- SplitterEvent.cs
- DataGridViewLinkCell.cs
- XmlLanguageConverter.cs
- DynamicILGenerator.cs
- FontSource.cs
- MetadataStore.cs
- PassportAuthentication.cs
- PropertyValueChangedEvent.cs
- ADMembershipUser.cs
- PrinterResolution.cs
- ProcessHost.cs
- Site.cs
- CatalogZoneDesigner.cs
- DummyDataSource.cs
- TreeViewCancelEvent.cs
- TextTreePropertyUndoUnit.cs
- ClientData.cs
- MeasureItemEvent.cs
- BaseTemplateCodeDomTreeGenerator.cs
- HtmlTernaryTree.cs
- ExpressionBindingCollection.cs
- ContentHostHelper.cs
- SystemTcpConnection.cs
- ScriptResourceHandler.cs