I am writing a plugin archiving jira issue to another service.
The transfer format of issue is json.
When I test on a collection of issues with the total number of issues is about 41000+, it always throw Out of memory exception after certain number of issues transfered.
The out of memory exception is throwed on line:
Any people encounter this? Using atlassian.jira.util.JSONObject getting out of memory exception?
Please help suggest and share thoughs here.
Thanks & Regards,
Thanks. Please see my answer below.
How much memory is allocated for Jira?
How big does your json object get?
>> combine jira rest json and svn plugin json string.
Are you trying to send multiple issues in a single json request?
>> no, one issue one json then send and handle another issue.
Can you use one of Java's memory leak detection tools?
>> could you please help recommend any one?
I am thinking maybe every time I process issue I will new a com.atlassian.jira.util.JSONObject cause this.
I try to reuse the JsonObject. but I failed to find mehtod on this object to reuse it.
Do you think set the reference as null will help?
Or another thought from mine is after processing every 1000 issues I put thread sleep for couple of seconds, will this help?
Thanks & Regards,
Page your response. That OOM can be thrown if a string is too large (which I suspect is the case). Serialization in JSON does not write directly to the stream (and since you need to keep it until you write it, you need memory), you either need to serialize pages of data or use json streaming.
Plus, there are some gotchas in the Jackson implementation ...
Hi, So do you know how to reuse the com.atlassian.util.JSONObject? I think for each issue, I will new some this class instances. Then it will consume the memory.
And I use HTTPURLConnection object to transfer the json.
I find I forget disconnect every time after I transfer the json.
Will this HTTPURLConnection object consume the memory?
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot