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
- PageCanvasSize.cs
- LinkDesigner.cs
- UnsafeNativeMethods.cs
- LeafCellTreeNode.cs
- DbDataSourceEnumerator.cs
- CodeArrayCreateExpression.cs
- EndpointIdentityConverter.cs
- PeerToPeerException.cs
- ListViewItem.cs
- DrawingContextWalker.cs
- DynamicRouteExpression.cs
- DBParameter.cs
- ToolStripSplitButton.cs
- InternalCache.cs
- XmlValidatingReaderImpl.cs
- BaseTemplateParser.cs
- DBCSCodePageEncoding.cs
- CompilerWrapper.cs
- EntityClassGenerator.cs
- DocumentReference.cs
- localization.cs
- XmlDataLoader.cs
- iisPickupDirectory.cs
- AssemblyAttributes.cs
- CharacterHit.cs
- TextRunCache.cs
- SoapCommonClasses.cs
- XmlCharCheckingWriter.cs
- ArgumentNullException.cs
- XmlConverter.cs
- DateTime.cs
- WorkflowMarkupSerializationProvider.cs
- DocumentPageViewAutomationPeer.cs
- ServiceOperationParameter.cs
- DataGridView.cs
- ToolStripLocationCancelEventArgs.cs
- ContextStaticAttribute.cs
- PropertyEmitter.cs
- UniqueIdentifierService.cs
- ProxyGenerationError.cs
- ComplexTypeEmitter.cs
- Window.cs
- AnimatedTypeHelpers.cs
- ContextInformation.cs
- RawAppCommandInputReport.cs
- DynamicAttribute.cs
- DataGridViewToolTip.cs
- Opcode.cs
- XmlDataSource.cs
- BitmapData.cs
- BitmapFrame.cs
- ConfigPathUtility.cs
- DirectionalLight.cs
- PolyLineSegment.cs
- Convert.cs
- RegexCaptureCollection.cs
- Style.cs
- SqlXmlStorage.cs
- DrawTreeNodeEventArgs.cs
- XmlUTF8TextWriter.cs
- CryptoHelper.cs
- AssemblyHash.cs
- MSAAWinEventWrap.cs
- RelationshipDetailsCollection.cs
- ISAPIApplicationHost.cs
- SqlNotificationEventArgs.cs
- StrongNameIdentityPermission.cs
- DecodeHelper.cs
- SlotInfo.cs
- HttpValueCollection.cs
- WindowVisualStateTracker.cs
- RichTextBoxConstants.cs
- TextPointer.cs
- unitconverter.cs
- Size3DConverter.cs
- _HTTPDateParse.cs
- DisplayNameAttribute.cs
- DeviceContext.cs
- ViewPort3D.cs
- BuildProvider.cs
- HostVisual.cs
- SafeProcessHandle.cs
- TemplateInstanceAttribute.cs
- FieldNameLookup.cs
- Pair.cs
- MetaChildrenColumn.cs
- PropertyValueUIItem.cs
- DataViewSettingCollection.cs
- MarshalByRefObject.cs
- SQLMoney.cs
- XmlSchemaGroup.cs
- HtmlTernaryTree.cs
- SamlAuthenticationStatement.cs
- SortedList.cs
- CompiledQuery.cs
- HostedHttpContext.cs
- GlobalizationSection.cs
- _FtpControlStream.cs
- uribuilder.cs
- DataPagerField.cs