Page 1 of 1

Heap size error when appending to Response.ContentString

Posted: Thu Jun 25, 2020 4:13 am
by eddie9394
Anyone know the limit on Response.ContentString? When the following server module executes, it generated an error on iSeries job and hangs. The client eventually timed out. And I have to end the job to clear it.
This server module works fine if the result set is less then 25K rows

------------------------------------------------------------------------------------------------------
Srvroutine Name(ExcelDnLd) Response(*RESOURCE #response) Desc('Send Get Response as CSV ')

Select_Sql Fields(#Fields 1 ....) Io_Status(#wk_Status) Using(#SQLSTATEMENT)
Add_Entry To_List(#DataList)
Endselect

Selectlist Named(#DataList)
#response.ContentString += ('"' + #Field1.AsString + '","' + #Fields2 + '","' ..........'"' + #CRLF).AsNativeString <--- ERROR WHILE RUNNING THIS STATEMENT>
Endselect

#response.AttachmentFileName := "Download.csv"
#response.ContentType := "text/csv"

Endroutine
------------------------------------------------------------------------------------------------------

Error Message on the job log:
------------------------------------------------------------------------------
The heap space has reached its maximum allowable size.

Message ID . . . . . . : MCH6903 Severity . . . . . . . : 40
Message type . . . . . : Escape
Date sent . . . . . . : 06/05/20 Time sent . . . . . . : 14:25:52

Message . . . . : The heap space has reached its maximum allowable size.
Cause . . . . . : The heap space has reached its maximum allowable size. The heap space identifier is 0. The activation group mark is 2. The activation group mark will be zero if the heap space is not associated with an activation group.