For full functionality of this site it is necessary to enable JavaScript.
Here are the instructions how to enable JavaScript in your web browser.

Knowledge base

Find the answer to your question

Advanced Search PView

Search terms
Search Type
Product
Category
Language
Format
SDK
Sort by
Direction

Java SDK: I am getting 'com.ebay.sdk.SdkException: Java heap space ' error with some API calls

  • Answer ID 558
  • Published 07/23/2006 12:37 AM
  • Updated 10/20/2013 06:41 AM
  • Permalink https://ebaydts.com/eBayKBDetails?KBid=558
Product
What should I do if an API call returns 'com.ebay.sdk.SdkException: Java heap space' error in the Java SDK
The size of the Object returned in Axis client invoke function : java.lang.Object _resp = org.apache.axis.client.Call.invoke(new java.lang.Object[] {getProductFinder}) is quite large and your program needs to allocate more memory than is allowed in the JVM's current max heap default setting , so the system throws an OutOfMemoryError. Programs that work on very large amounts of data like GetSellerList, GetSellerTransaction and GetProductFinder need to increase max heap size.

You can set the JVM run time max heap size to 256MB or larger as: java -Xmx256m

Some might say that there is no way that the JVM's the default heap could not acomodate such data since the size of received data is in the order of Mb not hundred of MBS as below:
- HTTP Compression: send gzip request...
- HTTP Compression - gzip decompress response: ContentLength=513022
- HTTP Compression: send gzip request...
- HTTP Compression - gzip decompress response: ContentLength=755740
- HTTP Compression: send gzip request...
- HTTP Compression - gzip decompress response: ContentLength=711935

You need to check the JVM runtime memory size not just the data size returned when you see "java.lang.OutOfMemoryError" in a stack trace. The heap is described in the Java Virtual Machine Specification http://java.sun.com/docs/books/vmspec/2nd-edition/html/Overview.doc.html#15730 "The heap is the runtime data area from which memory for all class instances and arrays is allocated."

We have ran a mini memory size test : GetSellerList for a sandbox power seller and here is the result:

- HTTP Compression: send gzip request...
- HTTP Compression - gzip decompress response: ContentLength=57227
totalRuntimeMemory before the call: 2031616
totalRuntimeMemory after the call : 23937024

Even with JVM max heap size control enabled, we suggest you follow the KB article titled Guidelines for using DetailLevel and GranularityLevel in GetSellerList to reduce the volume of the response payload for a single API call: https://ebay.custhelp.com/cgi-bin/ebay.cfg/php/enduser/std_adp.php?p_faqid=381

How well did this answer your question?

Answers others found helpful

Print Email This Page Delicious Digg Facebook Reddit StumbleUpon Twitter