function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Baz DensonBaz Denson 

Heap size on HTTPResponse

I have some code as follows:
System.debug('Response Body size is '+response.getBodyAsBlob().size()); 
XmlStreamReader xsr = new XmlStreamReader(response.getBody()); 
String result = parseXML(xsr, dealerId);

The reaponse body size is returned as 3229916, so when I attempt to create an XMLStreamReader variable, the heap size limit is blown.

Can anyone suggest how I can refactor the code so I don't exceed the 6mb limit?
 
Raj VakatiRaj Vakati
Can u do one think if its wokrs for you .. 

Can you parse the XmlStreamReader  in async mode like queueable apex etc so that you will 12 mb limit 


Execution Governors and Limits: Total heap size Synchronous Limit: 6 MB  - Asynchronous Limit: 12 MB
and Email services heap size is 36 MB.
Baz DensonBaz Denson
Unfortunately, it has to be a synchronous call as the user initiates it and I display the results in a visual force page.