Heap size error when appending to Response.ContentString

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
eddie9394
Posts: 23
Joined: Tue Aug 14, 2018 11:03 pm

Heap size error when appending to Response.ContentString

Post by eddie9394 » Thu Jun 25, 2020 4:13 am

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.

Post Reply