Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- Update.cs
- TextServicesContext.cs
- HtmlTableRow.cs
- Run.cs
- ColumnMap.cs
- HttpException.cs
- ClientRuntime.cs
- PersonalizationEntry.cs
- WebRequest.cs
- XXXInfos.cs
- XmlSchemaCollection.cs
- ServerValidateEventArgs.cs
- DynamicRendererThreadManager.cs
- FigureHelper.cs
- CustomAttributeFormatException.cs
- Point3DAnimation.cs
- X509Chain.cs
- SmtpFailedRecipientsException.cs
- GetLedgerRequest.cs
- XmlEncoding.cs
- CodeTypeReferenceCollection.cs
- OletxTransactionFormatter.cs
- ByteStreamGeometryContext.cs
- Rijndael.cs
- RoleServiceManager.cs
- SqlConnection.cs
- BitmapEncoder.cs
- PaintValueEventArgs.cs
- XhtmlMobileTextWriter.cs
- PropertyGridCommands.cs
- DataSysAttribute.cs
- UIElementPropertyUndoUnit.cs
- GenericWebPart.cs
- ParameterModifier.cs
- ZipFileInfo.cs
- ProxyHwnd.cs
- LoginDesignerUtil.cs
- DebugView.cs
- TraceUtility.cs
- PointLightBase.cs
- ReachNamespaceInfo.cs
- HitTestParameters3D.cs
- ForeignKeyConstraint.cs
- FixedSOMLineRanges.cs
- Renderer.cs
- DependencyObject.cs
- EventProxy.cs
- DuplexChannelFactory.cs
- ByteStreamMessageUtility.cs
- SqlDataSourceQueryConverter.cs
- HttpHandlersSection.cs
- DesignerOptions.cs
- DetailsViewPageEventArgs.cs
- BrushConverter.cs
- ToolStrip.cs
- SpellerHighlightLayer.cs
- CounterCreationDataCollection.cs
- SafeNativeMethodsCLR.cs
- PathSegmentCollection.cs
- MessageEnumerator.cs
- DbDataSourceEnumerator.cs
- ProxyWebPartManager.cs
- OdbcParameter.cs
- AnnotationMap.cs
- ipaddressinformationcollection.cs
- Material.cs
- StringArrayConverter.cs
- PageCatalogPart.cs
- KeyTimeConverter.cs
- XmlRawWriterWrapper.cs
- BigInt.cs
- XmlSignatureManifest.cs
- ScriptIgnoreAttribute.cs
- ShapeTypeface.cs
- Property.cs
- RefType.cs
- TableSectionStyle.cs
- DragEvent.cs
- DataGridToolTip.cs
- Variant.cs
- TreeIterator.cs
- DataControlPagerLinkButton.cs
- GridViewItemAutomationPeer.cs
- TreeNode.cs
- SoapTransportImporter.cs
- Transform.cs
- SamlSecurityTokenAuthenticator.cs
- Transform3DGroup.cs
- DesignerActionTextItem.cs
- InternalRelationshipCollection.cs
- StringAnimationUsingKeyFrames.cs
- QilIterator.cs
- TextFormatterContext.cs
- RolePrincipal.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- FileUtil.cs
- ByteConverter.cs
- HttpServerVarsCollection.cs
- DbDataAdapter.cs
- HealthMonitoringSection.cs