Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / MS / Internal / IO / Packaging / TrackingMemoryStreamFactory.cs / 1305600 / 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
- InstanceKeyNotReadyException.cs
- DropDownButton.cs
- MouseActionConverter.cs
- AlignmentYValidation.cs
- WorkflowRuntimeService.cs
- DataServiceProcessingPipelineEventArgs.cs
- XmlSchemaIdentityConstraint.cs
- WindowsStartMenu.cs
- ActivityWithResultConverter.cs
- CommandHelpers.cs
- XmlIlGenerator.cs
- CssStyleCollection.cs
- BaseEntityWrapper.cs
- DefaultPropertyAttribute.cs
- CompilerResults.cs
- Privilege.cs
- CellParaClient.cs
- AuthenticationConfig.cs
- WeakRefEnumerator.cs
- BitmapEffectState.cs
- ValueOfAction.cs
- AnonymousIdentificationModule.cs
- PasswordRecoveryDesigner.cs
- precedingquery.cs
- WindowsScroll.cs
- Privilege.cs
- TypeDescriptionProvider.cs
- HtmlImage.cs
- ShapeTypeface.cs
- MultiByteCodec.cs
- PointCollection.cs
- AttachedPropertyMethodSelector.cs
- TdsValueSetter.cs
- ChangeTracker.cs
- StorageAssociationSetMapping.cs
- DataServiceRequestOfT.cs
- AuthorizationSection.cs
- SafeReversePInvokeHandle.cs
- InvalidCommandTreeException.cs
- XMLSchema.cs
- X509Utils.cs
- LOSFormatter.cs
- ToolTip.cs
- SecurityAttributeGenerationHelper.cs
- InputProcessorProfilesLoader.cs
- RequestUriProcessor.cs
- TypeExtensionConverter.cs
- OleDbException.cs
- TextContainerChangeEventArgs.cs
- HttpListenerException.cs
- ServiceInfo.cs
- UriParserTemplates.cs
- ControlBuilder.cs
- HostingEnvironmentSection.cs
- Keyboard.cs
- LogSwitch.cs
- DataReaderContainer.cs
- Selector.cs
- SerializationException.cs
- QuaternionAnimationBase.cs
- ColorBlend.cs
- SessionStateModule.cs
- pingexception.cs
- ISAPIApplicationHost.cs
- TreeViewImageIndexConverter.cs
- DataGridViewCellEventArgs.cs
- LogicalExpr.cs
- TemplateControlParser.cs
- TableColumnCollection.cs
- FlowDocumentPage.cs
- DateTimeOffsetStorage.cs
- TextClipboardData.cs
- StylusDevice.cs
- CapabilitiesAssignment.cs
- DbMetaDataFactory.cs
- StructuralCache.cs
- DataShape.cs
- ArrayConverter.cs
- AdapterDictionary.cs
- ViewgenContext.cs
- SynchronizedInputPattern.cs
- DetailsViewDeletedEventArgs.cs
- assertwrapper.cs
- StorageEntityTypeMapping.cs
- EventlogProvider.cs
- NavigationHelper.cs
- Int64Converter.cs
- FontSourceCollection.cs
- WebScriptEnablingElement.cs
- SelectionHighlightInfo.cs
- ParamArrayAttribute.cs
- ImageSourceTypeConverter.cs
- ImageListImage.cs
- CustomPopupPlacement.cs
- ArrayWithOffset.cs
- SessionStateContainer.cs
- FunctionMappingTranslator.cs
- StateRuntime.cs
- ConfigurationElementCollection.cs
- XmlSchemaSequence.cs