"Not enough storage" exception on Report Preview

It happened while having plently of free memory on a high spec desktop with 16GB RAM.

The failing report ran fine later and returned around 1500 records.
That SQL uses CROSS APPLY to return a bunch of JSON Properties but i think the load on SQL Server (Express Edition) is quite low compared to other operations.

SQL server max memory is set to 2GB (default).

Based on the crash data … it might have something to do with rendering multiline column data or very wide column data?? but the same report normally works fine.

=========
11/07/2019 09:42

[General Info]

Application: SambaPOS
Version: 5.2.20
Region: en
DB: SQ
Machine: POS-SERVER
User: samba
Date: 11/07/2019
Time: 02:42

User Explanation:

samba said "Scrolled down to bottom of Report Preview (Grid Mode).
Server Memory 16GB, 9GB Used, 7GB Free
"

[Exception Info 1]

Top-level Exception
Type: System.Runtime.InteropServices.COMException
Message: Not enough storage is available to process this command. (Exception from HRESULT: 0x80070008)
Source: PresentationCore
Stack Trace: at MS.Internal.TextFormatting.TextMetrics.FullTextLine.FormatLine(FullTextState fullText, Int32 cpFirst, Int32 lineLength, Int32 formatWidth, Int32 finiteFormatWidth, Int32 paragraphWidth, LineFlags lineFlags, FormattedTextSymbols collapsingSymbol)
at MS.Internal.TextFormatting.TextMetrics.FullTextLine…ctor(FormatSettings settings, Int32 cpFirst, Int32 lineLength, Int32 paragraphWidth, LineFlags lineFlags)
at MS.Internal.TextFormatting.TextFormatterImp.FormatLineInternal(TextSource textSource, Int32 firstCharIndex, Int32 lineLength, Double paragraphWidth, TextParagraphProperties paragraphProperties, TextLineBreak previousLineBreak, TextRunCache textRunCache)
at MS.Internal.TextFormatting.TextFormatterImp.FormatLine(TextSource textSource, Int32 firstCharIndex, Double paragraphWidth, TextParagraphProperties paragraphProperties, TextLineBreak previousLineBreak)
at System.Windows.Media.FormattedText.LineEnumerator.FormatLine(TextSource textSource, Int32 textSourcePosition, Double maxLineLength, TextParagraphProperties paraProps, TextLineBreak lineBreak)
at System.Windows.Media.FormattedText.LineEnumerator.MoveNext()
at System.Windows.Media.FormattedText.DrawAndCalculateMetrics(DrawingContext dc, Point drawingOffset, Boolean getBlackBoxMetrics)
at System.Windows.Media.FormattedText.get_Metrics()
at DevExpress.Xpf.Core.Native.FormattedTextContainer.Initialize(RenderTextBlockContext context)
at DevExpress.Xpf.Core.Native.RenderTextBlock.InitializeFormattedTextContainer(RenderTextBlockContext tbContext)
at DevExpress.Xpf.Core.Native.RenderTextBlock.PreApplyTemplate(FrameworkRenderElementContext context)
at DevExpress.Xpf.Core.Native.FrameworkRenderElement.ApplyTemplate(FrameworkRenderElementContext context)
at DevExpress.Xpf.Core.Native.FrameworkRenderElement.Measure(Size availableSize, FrameworkRenderElementContext context)
at DevExpress.Xpf.Core.Native.ChromeSlave.MeasureOverride(Size availableSize)
at DevExpress.Xpf.Core.Native.Chrome.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Inner Exception 1
Type: System.Runtime.InteropServices.COMException
Message: Not enough storage is available to process this command. (Exception from HRESULT: 0x80070008)
Source: mscorlib
Stack Trace: at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode, IntPtr errorInfo)
at MS.Internal.Text.TextInterface.Native.Util.ConvertHresultToException(Int32 hr)
at MS.Internal.Text.TextInterface.FontFace.GetDesignGlyphMetrics(UInt16* pGlyphIndices, UInt32 glyphCount, GlyphMetrics* pGlyphMetrics)
at System.Windows.Media.GlyphTypeface.GlyphMetrics(UInt16* pGlyphIndices, Int32 characterCount, GlyphMetrics* pGlyphMetrics, Double emSize, Single pixelsPerDip, TextFormattingMode textFormattingMode, Boolean isSideways)
at System.Windows.Media.GlyphTypeface.GetGlyphMetricsAndIndicesOptimized(UInt32* pCodepoints, Int32 characterCount, Double emSize, Single pixelsPerDip, UInt16[] glyphIndices, GlyphMetrics[] glyphMetrics, TextFormattingMode textFormattingMode, Boolean isSideways)
at System.Windows.Media.GlyphTypeface.GetGlyphMetricsOptimized(CharacterBufferRange characters, Double emSize, Single pixelsPerDip, UInt16[] glyphIndices, GlyphMetrics[] glyphMetrics, TextFormattingMode textFormattingMode, Boolean isSideways)
at System.Windows.Media.TextFormatting.TextShapeableCharacters.GetAdvanceWidthsUnshaped(Char* characterString, Int32 characterLength, Double scalingFactor, Int32* advanceWidthsUnshaped)
at MS.Internal.TextFormatting.LineServicesCallbacks.GetRunCharWidths(IntPtr pols, Plsrun plsrun, LsDevice device, Char* charString, Int32 stringLength, Int32 maxWidth, LsTFlow textFlow, Int32* charWidths, Int32& totalWidth, Int32& stringLengthFitted)


[Assembly Info]

mscorlib, Version=4.0.0.0
System, Version=4.0.0.0
Samba.Services, Version=1.0.0.0
Samba.Domain, Version=1.0.0.0
Samba.Infrastructure.Data, Version=1.0.0.0
System.ComponentModel.Composition, Version=4.0.0.0
Samba.Presentation.Services, Version=1.0.0.0
System.Core, Version=4.0.0.0
PresentationCore, Version=4.0.0.0
WindowsBase, Version=4.0.0.0
PresentationFramework, Version=4.0.0.0
DevExpress.Xpf.LayoutControl.v16.2, Version=16.2.13.0
System.Xml, Version=4.0.0.0
DevExpress.Xpf.Grid.v16.2, Version=16.2.13.0
DevExpress.Xpf.Grid.v16.2.Core, Version=16.2.13.0
System.Xaml, Version=4.0.0.0
Samba.Infrastructure, Version=1.0.0.0
Microsoft.Practices.Prism, Version=4.0.0.0
System.Runtime.Serialization, Version=4.0.0.0
Microsoft.Practices.Prism.MefExtensions, Version=4.0.0.0
DevExpress.Xpf.Core.v16.2, Version=16.2.13.0
System.Windows.Forms, Version=4.0.0.0
System.Drawing, Version=4.0.0.0
Samba.Persistance, Version=1.0.0.0
Stateless, Version=1.0.0.0
PropertyTools, Version=2012.4.14.1
Samba.Localization, Version=1.0.0.0
ReachFramework, Version=4.0.0.0
EntityFramework, Version=6.0.0.0
FluentValidation, Version=3.4.0.0
NCalc, Version=1.3.8.0
Microsoft.CSharp, Version=4.0.0.0
Omu.ValueInjecter, Version=2.3.0.0
Microsoft.Practices.ServiceLocation, Version=1.0.0.0
DevExpress.Data.v16.2, Version=16.2.13.0
WindowsInput, Version=1.0.4.0


[System Info]

Operating System
-Microsoft Windows 10 Pro
–CodeSet = 1252
–CSDVersion =
–CurrentTimeZone = 420
–FreePhysicalMemory = 9251864
–OSArchitecture = 64-bit
–OSLanguage = 2057
–ServicePackMajorVersion = 0
–ServicePackMinorVersion = 0
–Version = 10.0.15063

Machine
-POS-SERVER
–Manufacturer = System manufacturer
–Model = System Product Name
–TotalPhysicalMemory = 16968839168
–UserName = POS-SERVER\samba


This issue was likely caused by memory leaks which cause memory allocations to reach limits imposed by a 32 bit process (maximum of half the 32 bit address space = 2GB max).
I think this bug can be safely ignored when the memory leaks are fixed.

1 Like