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
- XamlToRtfParser.cs
- DesignTimeVisibleAttribute.cs
- _DigestClient.cs
- DefaultHttpHandler.cs
- TerminateDesigner.cs
- GenericTextProperties.cs
- ChangeConflicts.cs
- CollectionDataContract.cs
- InfoCardClaim.cs
- TransformerConfigurationWizardBase.cs
- DescendentsWalker.cs
- GenericQueueSurrogate.cs
- DbRetry.cs
- DecoderReplacementFallback.cs
- TextMarkerSource.cs
- ColorConvertedBitmap.cs
- DataGridViewCellParsingEventArgs.cs
- MultidimensionalArrayItemReference.cs
- UnhandledExceptionEventArgs.cs
- HandleCollector.cs
- Decimal.cs
- SortAction.cs
- DbProviderManifest.cs
- TypeLibConverter.cs
- WebPartAuthorizationEventArgs.cs
- ClonableStack.cs
- ArrayWithOffset.cs
- DataError.cs
- StyleModeStack.cs
- FlowLayoutSettings.cs
- StylusDevice.cs
- PreservationFileWriter.cs
- OleDbEnumerator.cs
- Token.cs
- CmsInterop.cs
- SqlProviderManifest.cs
- DataGridViewRow.cs
- Context.cs
- AdornerPresentationContext.cs
- TraceContext.cs
- CustomBinding.cs
- EntityWrapper.cs
- CssStyleCollection.cs
- EncodingNLS.cs
- ListViewInsertEventArgs.cs
- RowUpdatedEventArgs.cs
- TextPattern.cs
- AmbientEnvironment.cs
- TableHeaderCell.cs
- Point3DCollectionConverter.cs
- Oid.cs
- WindowsSysHeader.cs
- ContainerAction.cs
- NameValueCollection.cs
- GridToolTip.cs
- SHA1CryptoServiceProvider.cs
- ReaderOutput.cs
- SchemaElementLookUpTable.cs
- CoTaskMemSafeHandle.cs
- Keywords.cs
- TextShapeableCharacters.cs
- LayoutExceptionEventArgs.cs
- SoapExtensionTypeElementCollection.cs
- NavigationPropertyEmitter.cs
- ConvertEvent.cs
- StructuredTypeEmitter.cs
- TransformerConfigurationWizardBase.cs
- UnmanagedHandle.cs
- ToolStripPanelCell.cs
- DeferrableContent.cs
- DesignerProperties.cs
- RangeValidator.cs
- MsmqPoisonMessageException.cs
- KeyboardNavigation.cs
- AttributeCollection.cs
- FontFamilyConverter.cs
- DataSourceControlBuilder.cs
- KeyManager.cs
- DatagridviewDisplayedBandsData.cs
- ProtectedUri.cs
- CustomAttribute.cs
- IsolationInterop.cs
- TabControlEvent.cs
- OrderedParallelQuery.cs
- XmlAttributeCollection.cs
- RelationshipFixer.cs
- InternalBase.cs
- SmiSettersStream.cs
- ProfilePropertySettingsCollection.cs
- DbException.cs
- RegexCompiler.cs
- HtmlTable.cs
- KeyValuePair.cs
- ContextBase.cs
- Scripts.cs
- Pipe.cs
- DataGridViewCellLinkedList.cs
- DetailsViewInsertedEventArgs.cs
- SettingsPropertyCollection.cs
- WebPartDescription.cs