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
- RubberbandSelector.cs
- VariantWrapper.cs
- TraceProvider.cs
- Condition.cs
- XsltInput.cs
- BaseValidator.cs
- URL.cs
- WpfKnownType.cs
- DuplicateDetector.cs
- SignatureHelper.cs
- SqlRecordBuffer.cs
- TransformationRules.cs
- CopyAction.cs
- DataGridViewRowPostPaintEventArgs.cs
- ClientBuildManager.cs
- ComponentCollection.cs
- DispatchChannelSink.cs
- TabControlEvent.cs
- PrivacyNoticeBindingElement.cs
- ipaddressinformationcollection.cs
- SiteMapPathDesigner.cs
- ElementsClipboardData.cs
- TypeUsageBuilder.cs
- DrawingGroup.cs
- PasswordTextNavigator.cs
- XmlNullResolver.cs
- BitmapEffectDrawing.cs
- ResourceKey.cs
- ReadOnlyObservableCollection.cs
- LinqDataSourceEditData.cs
- MessageQueue.cs
- ContextDataSourceView.cs
- PopupRootAutomationPeer.cs
- ContextStaticAttribute.cs
- RoutedPropertyChangedEventArgs.cs
- TextDecorationUnitValidation.cs
- ValidationEventArgs.cs
- MetadataPropertyCollection.cs
- AttributeData.cs
- Math.cs
- DbMetaDataColumnNames.cs
- Ops.cs
- ProtectedConfiguration.cs
- WebResourceAttribute.cs
- ConsoleKeyInfo.cs
- KeyedCollection.cs
- tabpagecollectioneditor.cs
- SQLDateTimeStorage.cs
- AnnotationComponentManager.cs
- Mutex.cs
- QuarticEase.cs
- DataGridParentRows.cs
- NotCondition.cs
- WorkflowViewStateService.cs
- StatusBarAutomationPeer.cs
- UserPreference.cs
- Binding.cs
- BasicCellRelation.cs
- NetPipeSection.cs
- XmlHierarchicalEnumerable.cs
- TempEnvironment.cs
- CanExecuteRoutedEventArgs.cs
- PeerCollaboration.cs
- DataPager.cs
- DrawingContextWalker.cs
- ErrorInfoXmlDocument.cs
- HtmlTableRowCollection.cs
- FixedSOMTable.cs
- ObjectDisposedException.cs
- XmlReflectionImporter.cs
- Context.cs
- BaseDataListActionList.cs
- ConvertersCollection.cs
- DbMetaDataCollectionNames.cs
- CodeStatement.cs
- DoubleCollectionConverter.cs
- Animatable.cs
- RoleBoolean.cs
- BaseParser.cs
- XmlEncodedRawTextWriter.cs
- Convert.cs
- LoginName.cs
- WebConfigurationManager.cs
- RefreshEventArgs.cs
- ElementUtil.cs
- RSAPKCS1SignatureFormatter.cs
- MemberHolder.cs
- COM2ExtendedBrowsingHandler.cs
- AdCreatedEventArgs.cs
- FlowDocumentReader.cs
- MeasurementDCInfo.cs
- SnapshotChangeTrackingStrategy.cs
- ConstraintEnumerator.cs
- StructuredProperty.cs
- ExceptionWrapper.cs
- __TransparentProxy.cs
- Parallel.cs
- PropertyManager.cs
- WebPartVerbsEventArgs.cs
- SqlNotificationEventArgs.cs