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
- PermissionSetEnumerator.cs
- DecoderFallback.cs
- ApplicationSecurityInfo.cs
- LayoutEditorPart.cs
- ProfileService.cs
- GridViewRowCollection.cs
- CompiledXpathExpr.cs
- FileNotFoundException.cs
- precedingquery.cs
- ConfigXmlCDataSection.cs
- SurrogateEncoder.cs
- Action.cs
- SendingRequestEventArgs.cs
- SharedPersonalizationStateInfo.cs
- FactoryMaker.cs
- TextElement.cs
- IssuanceLicense.cs
- ITreeGenerator.cs
- ActivitiesCollection.cs
- TreeNodeMouseHoverEvent.cs
- XmlSerializerAssemblyAttribute.cs
- _ProxyRegBlob.cs
- FileSystemInfo.cs
- SecurityContext.cs
- DbProviderFactory.cs
- EntityUtil.cs
- HMACSHA512.cs
- InvalidAsynchronousStateException.cs
- Point4DValueSerializer.cs
- AlignmentXValidation.cs
- NativeMethodsCLR.cs
- WindowsGraphics.cs
- MessageQueue.cs
- XmlName.cs
- StaticExtension.cs
- ValueConversionAttribute.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- FontNamesConverter.cs
- Hash.cs
- SqlHelper.cs
- PartialCachingAttribute.cs
- WhiteSpaceTrimStringConverter.cs
- RelOps.cs
- DiscoveryClientDuplexChannel.cs
- AxWrapperGen.cs
- ChangePassword.cs
- CodeActivity.cs
- DescendantBaseQuery.cs
- HealthMonitoringSectionHelper.cs
- BindingCollectionElement.cs
- UserPersonalizationStateInfo.cs
- WizardPanel.cs
- DefaultProxySection.cs
- SafeProcessHandle.cs
- sqlcontext.cs
- SqlException.cs
- ConfigurationSectionGroup.cs
- XmlSerializerNamespaces.cs
- PlanCompilerUtil.cs
- TableDetailsRow.cs
- Transform3D.cs
- PictureBox.cs
- InstanceLockTracking.cs
- TypeBuilderInstantiation.cs
- CodeVariableReferenceExpression.cs
- XmlAttributeCache.cs
- ConfigurationSection.cs
- XamlDesignerSerializationManager.cs
- FamilyTypeface.cs
- AlphabetConverter.cs
- SrgsRule.cs
- TextSelectionHighlightLayer.cs
- DataTableClearEvent.cs
- DBSqlParserTableCollection.cs
- QilStrConcatenator.cs
- RootBrowserWindow.cs
- ThreadStartException.cs
- HostnameComparisonMode.cs
- MasterPageCodeDomTreeGenerator.cs
- EmptyStringExpandableObjectConverter.cs
- SoapEnvelopeProcessingElement.cs
- OSFeature.cs
- IndividualDeviceConfig.cs
- ZipIOCentralDirectoryFileHeader.cs
- KeyValuePairs.cs
- Line.cs
- X509Chain.cs
- SiteMapProvider.cs
- WebControl.cs
- BaseEntityWrapper.cs
- Calendar.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- MulticastDelegate.cs
- XsltSettings.cs
- ConfigurationStrings.cs
- ServiceBehaviorElement.cs
- While.cs
- ContentType.cs
- ParameterReplacerVisitor.cs
- ToolStripPanelRow.cs