ESubstringAllocError Exception

Exception→ESubstringError→ESubstringAllocError

type ESubstringAllocError = class(ESubstringError);

Memory an operation would take from the memory manager while SubstringAllocCheck is True, outside Capacity and Resize.

Examples

A very long text always takes memory from the memory manager, so under the check it raises.

delphi
uses Substr;

procedure Example;
var Raised: Boolean;
begin
    Raised := False;
    SubstringAllocCheck := True;
    try
        try
            Assert(Substring.Create('x', 600000).Length = 600000);
        except
            on ESubstringAllocError do Raised := True;
        end;
    finally
        SubstringAllocCheck := False;
    end;
    Assert(Raised);
end;