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
- SelectionGlyph.cs
- ExpressionCopier.cs
- CodeCastExpression.cs
- RouteData.cs
- LineInfo.cs
- ToolStripOverflowButton.cs
- CallContext.cs
- DataGridViewColumn.cs
- MetadataUtil.cs
- Certificate.cs
- ConsumerConnectionPoint.cs
- SubMenuStyleCollectionEditor.cs
- SolidBrush.cs
- DesignerAutoFormatStyle.cs
- BindingCompleteEventArgs.cs
- GroupStyle.cs
- TrustManagerPromptUI.cs
- ScriptReference.cs
- relpropertyhelper.cs
- RangeContentEnumerator.cs
- MessageDescriptionCollection.cs
- TagPrefixAttribute.cs
- shaperfactoryquerycachekey.cs
- SetUserLanguageRequest.cs
- Triangle.cs
- SemanticValue.cs
- formatter.cs
- JsonReaderDelegator.cs
- StringExpressionSet.cs
- GlyphShapingProperties.cs
- OleDbMetaDataFactory.cs
- X509CertificateStore.cs
- XPathNodePointer.cs
- OleDbPropertySetGuid.cs
- StateBag.cs
- AsymmetricAlgorithm.cs
- PageParser.cs
- Monitor.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- HttpApplicationFactory.cs
- Image.cs
- ListControl.cs
- FontFaceLayoutInfo.cs
- PlainXmlDeserializer.cs
- QuadTree.cs
- HtmlDocument.cs
- EventMap.cs
- RegexParser.cs
- WorkflowTimerService.cs
- StrokeNodeEnumerator.cs
- Model3DGroup.cs
- BuildProvider.cs
- TdsParser.cs
- SqlServer2KCompatibilityAnnotation.cs
- DoubleAnimation.cs
- CachedFontFace.cs
- WebPartTransformer.cs
- StreamingContext.cs
- XPathNodeList.cs
- WindowsListViewGroupHelper.cs
- SecurityKeyUsage.cs
- FontStretches.cs
- XsltQilFactory.cs
- DelayedRegex.cs
- MenuAdapter.cs
- DbConnectionClosed.cs
- TableRow.cs
- DomainUpDown.cs
- MulticastOption.cs
- MenuItemStyleCollection.cs
- SeekStoryboard.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- WebBrowserPermission.cs
- KnownTypesHelper.cs
- PointConverter.cs
- TripleDES.cs
- XmlNamedNodeMap.cs
- RequestTimeoutManager.cs
- ToolStripCustomTypeDescriptor.cs
- _IPv6Address.cs
- SqlBinder.cs
- LinkTarget.cs
- Rotation3DAnimationUsingKeyFrames.cs
- XmlObjectSerializerWriteContextComplex.cs
- DataGridViewDesigner.cs
- ConstraintManager.cs
- ProcessModelSection.cs
- HelpInfo.cs
- ReadOnlyNameValueCollection.cs
- AdornerLayer.cs
- FileDialogPermission.cs
- TrackingWorkflowEventArgs.cs
- WebPartCatalogCloseVerb.cs
- AmbientLight.cs
- PreservationFileWriter.cs
- Pair.cs
- _TimerThread.cs
- StringConcat.cs
- ToolStripArrowRenderEventArgs.cs
- BitHelper.cs