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
- DataGridViewDataConnection.cs
- DynamicEntity.cs
- KnowledgeBase.cs
- BinaryObjectReader.cs
- SamlAuthorizationDecisionStatement.cs
- ExpressionContext.cs
- MulticastIPAddressInformationCollection.cs
- CodeGenHelper.cs
- StringPropertyBuilder.cs
- NumberFormatter.cs
- TextElementEnumerator.cs
- NumericUpDownAccelerationCollection.cs
- BitmapEffectGroup.cs
- ChineseLunisolarCalendar.cs
- DataControlFieldCell.cs
- SecurityCriticalDataForSet.cs
- Nullable.cs
- IgnorePropertiesAttribute.cs
- EmptyCollection.cs
- SqlLiftIndependentRowExpressions.cs
- ClassGenerator.cs
- TextFormatterImp.cs
- MemberMemberBinding.cs
- DataBindingList.cs
- TableParagraph.cs
- VoiceInfo.cs
- ContextStack.cs
- GridViewRowPresenterBase.cs
- View.cs
- DispatcherTimer.cs
- COM2IDispatchConverter.cs
- SmiConnection.cs
- NativeRightsManagementAPIsStructures.cs
- HealthMonitoringSectionHelper.cs
- StringValidatorAttribute.cs
- XmlReturnReader.cs
- XPathArrayIterator.cs
- GetCertificateRequest.cs
- GenericsInstances.cs
- EventMappingSettingsCollection.cs
- EventHandlersStore.cs
- ForwardPositionQuery.cs
- WorkflowMarkupElementEventArgs.cs
- ProxyGenerator.cs
- DataGridViewAutoSizeModeEventArgs.cs
- TextStore.cs
- DbProviderFactories.cs
- WebRequestModulesSection.cs
- ScrollBar.cs
- UnsafeNativeMethods.cs
- MetadataArtifactLoaderCompositeFile.cs
- RoleService.cs
- PopupRootAutomationPeer.cs
- WebEventCodes.cs
- EntityDesignerUtils.cs
- EntityConnectionStringBuilder.cs
- SerializationException.cs
- WebServiceEnumData.cs
- OutputCacheEntry.cs
- FastEncoderWindow.cs
- SmiMetaData.cs
- ToolStripKeyboardHandlingService.cs
- CalendarDataBindingHandler.cs
- Stream.cs
- Msmq.cs
- GridSplitterAutomationPeer.cs
- _NegotiateClient.cs
- ListView.cs
- nulltextcontainer.cs
- IsolatedStoragePermission.cs
- COSERVERINFO.cs
- OrCondition.cs
- Typeface.cs
- UriExt.cs
- ReceiveActivityValidator.cs
- DataGridViewCellFormattingEventArgs.cs
- Transform.cs
- SignatureDescription.cs
- InkPresenterAutomationPeer.cs
- ExpressionBindingCollection.cs
- TabPanel.cs
- MailMessage.cs
- EditorPart.cs
- ExpressionUtilities.cs
- TraceHandler.cs
- HttpDateParse.cs
- EventLog.cs
- IPEndPoint.cs
- TimeSpanValidatorAttribute.cs
- ErrorRuntimeConfig.cs
- LoaderAllocator.cs
- WinFormsSpinner.cs
- ProvidersHelper.cs
- XmlEncoding.cs
- CommandField.cs
- Matrix3DValueSerializer.cs
- DesignerOptionService.cs
- AnnotationAdorner.cs
- TabPanel.cs
- ServiceDescriptions.cs