Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Load large string into TStringBuilder
Sun, Feb 25 2018 2:48 AMPermanent Link

thomh

I am returning a large base64 encoded PNG image file in a JSON formatted string.

However, when I run it through the UnEscapeJSON method I get a "Maximum callstack size exceeded" error in the TStringBuilder constructor. Seems to happen in the TStringBuilder.Append method.

If I save the base64 string to a file, the file size is 125KB.

Is this a limitation of the TStringBuilder class or the browser in general?

Thanks.

// Thom
Tue, Feb 27 2018 2:17 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Thom,

<< I am returning a large base64 encoded PNG image file in a JSON formatted string.

However, when I run it through the UnEscapeJSON method I get a "Maximum callstack size exceeded" error in the TStringBuilder constructor. Seems to happen in the TStringBuilder.Append method.

If I save the base64 string to a file, the file size is 125KB.

Is this a limitation of the TStringBuilder class or the browser in general? >>

Hmm, this is a weird one.  The UnEscapeJSON method doesn't actually perform any recursion, and neither does the TStringBuilder or the JSON parsing in general.

If you can reproduce this, please send me an example project and I'll take a look.

Tim Young
Elevate Software
www.elevatesoft.com
Image