Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Java Development
- :
- Out of memory while downloading Attachment
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Out of memory while downloadin g Attachment
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-04-2012 10:19 AM
Hi Team,
I am trying to download the attachment from salesforce using SObject. Its working fine for the files less than 2MB size but failing with java out of memory : heap space error message for the file more than 2MB. We have the limit of 25MB in salesforce.
I have pasted the stack trace below. Your suggestion and guidance in this issue is much appreciated.
[Error]
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2882)
at java.lang.AbstractStringBuilder.expandCapacity(Abs
at java.lang.AbstractStringBuilder.append(AbstractStr
at java.lang.StringBuilder.append(StringBuilder.java:
at com.sforce.ws.bind.XmlObject.loadAfterStartTag(Xml
at com.sforce.ws.bind.XmlObject.load(XmlObject.java:2
at com.sforce.ws.bind.XmlObject.loadAfterStartTag(Xml
at com.sforce.ws.bind.XmlObject.load(XmlObject.java:2
at com.sforce.ws.bind.TypeMapper.readSingle(TypeMappe
at com.sforce.ws.bind.TypeMapper.readArray(TypeMapper
at com.sforce.ws.bind.TypeMapper.readObject(TypeMappe
at com.sforce.soap.partner.QueryResult.loadFields(Que
at com.sforce.soap.partner.QueryResult.load(QueryResu
at com.sforce.ws.bind.TypeMapper.readSingle(TypeMappe
at com.sforce.ws.bind.TypeMapper.readObject(TypeMappe
at com.sforce.soap.partner.QueryMoreResponse_element.
at com.sforce.soap.partner.QueryMoreResponse_element.
at com.sforce.ws.bind.TypeMapper.readSingle(TypeMappe
at com.sforce.ws.bind.TypeMapper.readObject(TypeMappe
at com.sforce.ws.transport.SoapConnection.bind(SoapCo
at com.sforce.ws.transport.SoapConnection.receive(Soa
at com.sforce.ws.transport.SoapConnection.send(SoapCo
at com.sforce.soap.partner.PartnerConnection.queryMor
at com.informatica.cloudlabs.adapter.chatter.utils.Ch
at com.informatica.cloudlabs.adapter.chatter.utils.Ch
at com.informatica.cloudlabs.adapter.chatter.read.Cha
at com.informatica.cloud.api.adapter.reader.runtime.G
[/Error]
Re: Out of memory while downloadin g Attachment
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-10-2012 10:51 AM
Have you specified the -Xmx java property to your web app server? And if so how much memory are you allocating?
If you are not, you may want to add this property and allocate more memory with -Xmx256m, this may solve your problem. This would happen if it was trying to copy a string/input that was greather than half the heap space.

