ReadyAPI "java.lang.OutOfMemoryError"
I'm running ReadyAPI and I'm new to the application. I keep getting this error running a request from the app. However, when I run a request manually to the actual application, it works fine. I've update the following parameters with no change; -Xms4096m and -Xmx24576m. The actual error is: ERROR: Thu Jan 22 13:36:29 MST 2026: ERROR: java.lang.OutOfMemoryError: UTF16 String size is 1074003966, should be less than 1073741823. Does anyone know how to fix this issue or have a work around?
UPDATE: I was able to get ReadyAPI to complete for a large API Request on one of our instances. The bottom line is, when working with huge data responses from an API request in ReadyAPI, you need to manage memory efficiently and avoid loading the entire response into memory if possible. ReadyAPI’s standard test steps (like REST or SOAP Request) will load the full response into memory and that's where I was getting errors. However, you can use Groovy scripting to process the response in chunks or stream it for large payloads.
To run an API request directly from a Groovy script and process streaming chunks of data, I found this script:
import java.net.HttpURLConnection import java.net.URL import java.util.Arrays //def apiUrl = 'https://your.api.endpoint/large-data' def apiUrl = 'https://misp.cso.att.com//events/view/1003349' //Prod def connection = (HttpURLConnection) new URL(apiUrl).openConnection() //connection.setRequestMethod('GET') connection.setRequestProperty('Authorization', '<MISP Key>') //Test connection.setRequestProperty('Content-Type', 'application/json') connection.setRequestProperty('Accept', 'application/json') def bufferSize = 1 * 1024 * 1024 // 1 MB def buffer = new byte[bufferSize] def inputStream = connection.getInputStream() def bytesRead def chunkIndex = 0 try { while ((bytesRead = inputStream.read(buffer)) != -1) { // Use Arrays.copyOfRange for an actual byte[] def chunk = (bytesRead == bufferSize) ? buffer : Arrays.copyOfRange(buffer, 0, bytesRead) def chunkString = new String(chunk, 'UTF-8') log.info "Chunk #${chunkIndex} (${bytesRead} bytes):\n${chunkString}\n" chunkIndex++ } } finally { inputStream.close() connection.disconnect() log.info "Finished streaming and printing data in chunks." }This issue can be closed.