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
- IndexingContentUnit.cs
- OptimizedTemplateContentHelper.cs
- XmlIncludeAttribute.cs
- PropertyChangedEventArgs.cs
- SchemaObjectWriter.cs
- DataPagerFieldCommandEventArgs.cs
- CatalogZoneBase.cs
- RouteUrlExpressionBuilder.cs
- SortedSet.cs
- _StreamFramer.cs
- DefaultHttpHandler.cs
- BamlStream.cs
- bindurihelper.cs
- Types.cs
- ReadWriteObjectLock.cs
- SafeNativeMethods.cs
- Point3DConverter.cs
- Compensation.cs
- OracleParameterCollection.cs
- SymmetricCryptoHandle.cs
- DynamicMethod.cs
- WindowsHyperlink.cs
- TerminateDesigner.cs
- Transaction.cs
- ExpandableObjectConverter.cs
- DocumentEventArgs.cs
- Stack.cs
- SQLBinary.cs
- ContactManager.cs
- IPAddressCollection.cs
- DocumentApplicationDocumentViewer.cs
- Configuration.cs
- Substitution.cs
- WinFormsUtils.cs
- OpCodes.cs
- EraserBehavior.cs
- EncodingFallbackAwareXmlTextWriter.cs
- KeyValuePairs.cs
- SolidColorBrush.cs
- ViewManager.cs
- safelink.cs
- QilDataSource.cs
- OleDbCommandBuilder.cs
- UpdateCommand.cs
- Binding.cs
- RoleServiceManager.cs
- DataControlFieldCollection.cs
- DateTimeParse.cs
- ToolStripItemDataObject.cs
- ChannelServices.cs
- objectquery_tresulttype.cs
- SiteMapPathDesigner.cs
- ResXFileRef.cs
- XmlNotation.cs
- DataGridViewSelectedCellCollection.cs
- SmiRequestExecutor.cs
- ValueOfAction.cs
- FormsIdentity.cs
- WebBodyFormatMessageProperty.cs
- FixedSOMTable.cs
- ClonableStack.cs
- SizeIndependentAnimationStorage.cs
- ExpressionList.cs
- TextHidden.cs
- FlowSwitchDesigner.xaml.cs
- AnimatedTypeHelpers.cs
- BinHexEncoding.cs
- Pkcs7Recipient.cs
- ControlCachePolicy.cs
- SecureStringHasher.cs
- HttpApplicationFactory.cs
- _AcceptOverlappedAsyncResult.cs
- ComplexTypeEmitter.cs
- RegistryConfigurationProvider.cs
- SelectionRangeConverter.cs
- TreeView.cs
- PersonalizationDictionary.cs
- TdsParserSafeHandles.cs
- AuthenticateEventArgs.cs
- IndexedEnumerable.cs
- ConstraintCollection.cs
- TextBox.cs
- ModelVisual3D.cs
- WebPartEditorOkVerb.cs
- PageParser.cs
- _NetRes.cs
- RelationshipWrapper.cs
- DtrList.cs
- diagnosticsswitches.cs
- MenuStrip.cs
- ServiceHttpModule.cs
- CompiledScopeCriteria.cs
- Array.cs
- ServiceDesigner.cs
- XmlMtomWriter.cs
- HttpRuntime.cs
- NullReferenceException.cs
- SingleAnimationBase.cs
- SatelliteContractVersionAttribute.cs
- FrameworkEventSource.cs