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
- ExpandableObjectConverter.cs
- XmlDataDocument.cs
- DeleteMemberBinder.cs
- InternalConfirm.cs
- PageStatePersister.cs
- Profiler.cs
- ProcessInfo.cs
- DependencyPropertyHelper.cs
- SessionParameter.cs
- FaultContractAttribute.cs
- login.cs
- RoleBoolean.cs
- SqlXmlStorage.cs
- SetterBase.cs
- DataGridCell.cs
- FixedTextSelectionProcessor.cs
- contentDescriptor.cs
- basecomparevalidator.cs
- WeakEventManager.cs
- DeflateStreamAsyncResult.cs
- NullToBooleanConverter.cs
- Model3D.cs
- SqlReferenceCollection.cs
- TransportListener.cs
- TranslateTransform.cs
- SafeLocalMemHandle.cs
- CodeDomSerializationProvider.cs
- ApplicationGesture.cs
- PermissionToken.cs
- UnsafeNativeMethods.cs
- TraceHandler.cs
- ByteBufferPool.cs
- DoubleLinkList.cs
- CodeLinePragma.cs
- PerformanceCounterCategory.cs
- ListViewPagedDataSource.cs
- ItemDragEvent.cs
- PropertyValueChangedEvent.cs
- FixedDocument.cs
- Deserializer.cs
- HTMLTextWriter.cs
- ActiveDocumentEvent.cs
- FrameworkContentElementAutomationPeer.cs
- PictureBoxDesigner.cs
- RuleSetBrowserDialog.cs
- GridViewSortEventArgs.cs
- HtmlForm.cs
- SqlXml.cs
- CorrelationTokenInvalidatedHandler.cs
- DataBoundControlDesigner.cs
- HWStack.cs
- ObjRef.cs
- _SslState.cs
- PersistChildrenAttribute.cs
- OleDbReferenceCollection.cs
- CategoryList.cs
- InkCanvasFeedbackAdorner.cs
- ConditionalBranch.cs
- TransactionFormatter.cs
- CollectionBase.cs
- WindowHideOrCloseTracker.cs
- DragStartedEventArgs.cs
- XsltLoader.cs
- NativeCppClassAttribute.cs
- XmlDataLoader.cs
- TableHeaderCell.cs
- WindowExtensionMethods.cs
- SortExpressionBuilder.cs
- _SingleItemRequestCache.cs
- StylusLogic.cs
- DeferredTextReference.cs
- ColumnMapCopier.cs
- WhitespaceRuleLookup.cs
- RelationshipEndMember.cs
- PeerNameRecordCollection.cs
- SystemUnicastIPAddressInformation.cs
- EntityRecordInfo.cs
- XmlSchemaSearchPattern.cs
- OutputScope.cs
- ControlType.cs
- ToolStripItemCollection.cs
- ForeignConstraint.cs
- ContentPresenter.cs
- Bidi.cs
- TreeNodeConverter.cs
- ActivityExecutionContext.cs
- Table.cs
- GlobalAllocSafeHandle.cs
- InternalsVisibleToAttribute.cs
- PersonalizationProviderCollection.cs
- WindowsPen.cs
- PageCanvasSize.cs
- WaitHandleCannotBeOpenedException.cs
- WmlValidatorAdapter.cs
- IndependentlyAnimatedPropertyMetadata.cs
- DotExpr.cs
- LinqDataSourceValidationException.cs
- EncodingNLS.cs
- MultiDataTrigger.cs
- X509CertificateCollection.cs