Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / MS / Internal / IO / Packaging / TrackingMemoryStreamFactory.cs / 1305600 / 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
- EventItfInfo.cs
- ForeignKeyConstraint.cs
- DebugHandleTracker.cs
- ReadWriteSpinLock.cs
- MenuItem.cs
- PopupRootAutomationPeer.cs
- HierarchicalDataSourceControl.cs
- Hyperlink.cs
- IdSpace.cs
- SelectedGridItemChangedEvent.cs
- _OSSOCK.cs
- FixedHighlight.cs
- IndicCharClassifier.cs
- Guid.cs
- SerialReceived.cs
- HttpListenerContext.cs
- AppDomainCompilerProxy.cs
- MsmqTransportElement.cs
- UpDownEvent.cs
- Rijndael.cs
- MetadataItemEmitter.cs
- SiteMapNode.cs
- GradientStopCollection.cs
- MenuCommand.cs
- PathFigureCollection.cs
- _SslState.cs
- OrderedDictionaryStateHelper.cs
- PageCatalogPartDesigner.cs
- GridEntryCollection.cs
- XmlTextReaderImpl.cs
- Types.cs
- XmlEntityReference.cs
- GridViewAutomationPeer.cs
- ControlBuilderAttribute.cs
- LiteralControl.cs
- TdsValueSetter.cs
- ValueTable.cs
- Image.cs
- HybridCollection.cs
- HMACSHA384.cs
- NavigationPropertyEmitter.cs
- SerialReceived.cs
- TriggerAction.cs
- Lock.cs
- PasswordBoxAutomationPeer.cs
- DynamicObject.cs
- EventEntry.cs
- SerialReceived.cs
- JournalEntry.cs
- FacetChecker.cs
- LoginCancelEventArgs.cs
- ZipIOExtraField.cs
- Int32CAMarshaler.cs
- DriveNotFoundException.cs
- SystemIPGlobalProperties.cs
- BuildDependencySet.cs
- TextSpan.cs
- ResolveResponse.cs
- WhitespaceRuleLookup.cs
- SwitchLevelAttribute.cs
- TypeLoadException.cs
- TextRunProperties.cs
- ReturnEventArgs.cs
- ConfigurationStrings.cs
- TextBlockAutomationPeer.cs
- SqlGenerator.cs
- GetImportedCardRequest.cs
- RotateTransform.cs
- login.cs
- UnionCodeGroup.cs
- TypeUsage.cs
- MissingManifestResourceException.cs
- ProfileBuildProvider.cs
- Knowncolors.cs
- DataGridViewRow.cs
- SponsorHelper.cs
- VectorKeyFrameCollection.cs
- ToggleButton.cs
- FormView.cs
- PropertyContainer.cs
- ClientData.cs
- ServiceEndpoint.cs
- HtmlSelectionListAdapter.cs
- ColumnWidthChangingEvent.cs
- ChildrenQuery.cs
- Listbox.cs
- ArraySortHelper.cs
- ButtonPopupAdapter.cs
- Literal.cs
- TdsParserStaticMethods.cs
- SelectionManager.cs
- CodeTypeReference.cs
- NavigateEvent.cs
- SeverityFilter.cs
- Random.cs
- UpDownEvent.cs
- BooleanConverter.cs
- PageRequestManager.cs
- XmlAnyAttributeAttribute.cs
- XmlUtil.cs