on 12-19-2014 10:17 AM
Hi All ,
I am using SAP JCO to get data from SAP using java. I am using RFC_READ_TABLE function to fetch data.
For small amount of data it's working fine. but when I am trying to get data from table which has records in lakhs .It's throwing error as "OutOfMemoryError: Java heap space ". I have already increased heap size to max of RAM size(1300m).
When I did memory analysis by taking heapdump it shows memory is utilized max for "com.sap.conn.jco.rt.DefaultTable".
Please help to resolve this problem.
Thanks Markus and Stefan for your valuable reply.
Could you please tell me ,how we can shape the data in a smaller packages? as I am fetching only required fields from the table and could you please elaborate about changing the dedicated function module?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Supriya,
The “java.lang.OutOfMemoryError: Java heap space” error is triggered when you try to add more data into the heap space area, but there is not enough room for it. There is no other option. You have to increase the heap size if you want to have that much of data.
There is one more reason of this error is memory leakage but in your case it is not correct.
Thanks,
Hamendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hamendra,
in case the data amount is too large, you will not get enough memory for getting the table into memory, that's normal. Options for you:
* increase the heap size even more and run on a 64bit JVM
* shape the data in smaller packages and don't read it as a whole
* Ensure to fetch only the fields you need.
But what you should definitely do: change to a dedicated function module. Do not use RFC_READ_TABLE. This is bypassing authority checks that are done on tables by applications. It's a bad practice ...
Best regards,
Markus
With reference to Markus' comment about the function module RFC_READ_TABLE - which is absolutely correct - I would like to add the following note:
382318 - FAQ|Function module RFC_READ_TABLE
Best regards,
Stefan
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.