Questions tagged [heap]

The tag has no usage guidance.

1
vote
3answers
88 views

Apex heap size too large: 14070486

I have implemented Batch apex for creating the custom records. Please see the details below. I am sending the each territory Id to execute method and this method will get the list of Goal object ...
7
votes
1answer
466 views

Deserialize hits memory limit

We have a custom apex webservice in which we do certain operations and later call a managed package apex method that returns a JSON string which we deserialize and send back to the client. For example ...
1
vote
1answer
15 views

Salesforce Heap with lists [duplicate]

I was writing a method in which i wanted to see if a value was in a specified list, instead of writing out if a==x || a==y || a==z if figured it would be shorter and cleaner to just do a list contains....
1
vote
2answers
74 views

Heap size LIMIT

I'm trying to reduce the heap size limit while a program is running - I'm doing it by taking the data (a list for example) and after I'm using it, I'm assigning the instance to a new List : Example: ...
1
vote
1answer
621 views

First error: Query of LOB fields caused heap usage to exceed limit

I simply try to execute a batch job and execute a SOQL inside the execute() method as below with having, execute() method has the line List results = (List)database.query(query); , and start() ...
7
votes
3answers
991 views

Ability of Apex Rest services to accept 50MB file, how is the heap size calculated in this case?

I have the below code where in we are accepting the blob data from the REST Apex class. We are inserting the document (blob) that we are receiving as a feed item. I was able to send file sizes upto 54 ...
0
votes
1answer
278 views

Heap size exceeding 6MB for simple soql and not getting any error. Strange!

I am running a soql to query 10,000 rows of an object & storing the result in a list. When I check my heap size after the query I see 70MB of heap space getting used & I dont get any exception....
5
votes
1answer
693 views

Writing too much to debug log increases heap and cpu time

I have just observed that writing to debug log using System.debug increases heap size as well as CPU time. Is this normal. Please see the screenshot below for the comparison. The first one with so ...
1
vote
1answer
359 views

Sketch of heap usage prior to algorithm implementation

I'm trying to have an idea of what would be the heap usage of a certain algorithm in Salesforce, given different inputs in order to determine if I should implement it async or sync. I am aware that ...
2
votes
1answer
20 views

Batchable start() method blows up Heap. How can this happen?

Production batchable blew up Heap in the start() method. Had been working OK before. start(), unlike typical use cases that use Database.QueryLocator used an Iterable. Code is shown below, ...
2
votes
0answers
438 views

Is File Upload through Lightning Components counted as part of Apex Heap Size?

In Winter 2018 release salesforce has released a new beta lightning component for uploading file through the lightning:fileUpload (Beta). The documentation in this link says we can upload a file of ...
1
vote
0answers
37 views

heap size is too large while querying data from 6 objects and adding it to the single list

I am querying from six objects and adding it to single sobject list. each object is having around 4000 records and 40 fields in each object. so total records will 24000 and all those records i keeping ...
6
votes
1answer
407 views

Soql for loop heap size. How to decide between speed and memory mangament

I am wondering how to decide between heap size and processing time. This probably rather trivial but I have been researching for about an hour. The two images I used system.debug(Limits.getHeapSize());...
1
vote
3answers
298 views

Limits.getHeapSize() wildly inaccurate?

So I have scenario where I need to process a bunch of blobs. I've tried to optimize my code and use Limits.getLimitHeapSize() to detect prevent limit exceptions, by first breaking the attachments into ...
12
votes
2answers
3k views

How is heap size calculated?

Scenario I'm trying to send a lot of data from Apex to VisualForce Page via JS remoting because I want to create an Excel file , so just for testing purpose I uploaded a text file (4.87 MB, 5110400 ...
3
votes
2answers
968 views

APEX Heap size and limit Confusion

Hi So I am trying to understand that what is heap and how it is managed in Salesforce. What I did is created a VF page and a Http callout class, I have stored a large XML on remote server that I am ...
5
votes
1answer
524 views

How to save large files in Salesforce with synchronous Apex?

I've created a Visualforce page that allows users to drag and drop files and have them uploaded to Salesforce and then displayed in a list immediately. To do so, my VF page sends the file in chunks ...
1
vote
1answer
289 views

Apex Heap Size Limit Exceeded

This question may asked in many posts and blogs but this became nightmare for me now. Please help me to overcome this issue Issue is Apex Heap Size Limit Exception while Saving a Record We have ...
1
vote
2answers
1k views

Attachment Cloning: System.LimitException: Query of LOB fields caused heap usage to exceed limit

So I am trying to clone ~11000 attachments over to new object records. I have developed the code below with help from this community and I have tested it on a sandbox with 3 attachments to move over. ...
1
vote
0answers
198 views

How to attach file using actionFunction

Could you help me please? I want to implement attaching files to Cases in SalesForce. There is recomanded way which using apex:inputFile element, but I can’t use it, because on page I have to use ...
6
votes
2answers
963 views

Does execute anonymous from Developer Console not enforce heap size limit?

I have been investigating a potential heap size problem in our production code, and I wanted to recreate some simple elements through the developer console. To cause a heap size exception, I would ...
1
vote
1answer
259 views

Why would I NOT want to use static controllers?

For starters, using static variables/methods resolves view state issues. I don't seem to notice any difference in VF behaviour when using static versus non-static methods either. So when would I use ...
1
vote
0answers
436 views

Data Loader ( Heap size error )

When trying to make a simple update conversion for a picklist, im getting heap size error. i'm ussing batch size = 1, and 13 rows only, wath could make it happen? Thanks. ID ERROR ...
2
votes
2answers
168 views

Heap size error when cloning FeedItem of type “ContentPost”

We are migrating our managed software from ObjectA to ObjectB. I want to move (via cloning) the Chatter Feeds (Items and Comments) from ObjectA to ObjectB. I alway run into Heap size limits when ...
0
votes
2answers
1k views

Get size of email attachment

I'm hitting the heap size limit when converting attachments to base64. I've already put it in a future and running at 3xheap. What I want to do is get the size of the attachment prior to conversion ...
7
votes
2answers
667 views

Error - Heap Size Too Large

I have a batch program that works in most scenarios, but if the number of leads is too many, I get the error "heap size is too large" I've tried removing elements from my list after they have ...
2
votes
1answer
281 views

Apex heap size error - VF dowloading attachments

I have one VF page from where I am trying to download some attachments - The time I tried to download attachments which includes Attachments of size 4 MB+ size, it start showing me this error. ...
1
vote
1answer
4k views

Apex heap size too large error

Is there any way to make this apex class more efficient? Currently, whenever a case with many case comments is escalated in our system, an error occurs stating the Apex heap size is too large. Any ...
18
votes
1answer
1k views

Batch performance impact of Database.Stateful

I know that a Batch will generally run faster when the Database.Stateful marker interface is not used. What I don't know is, how badly the serializing and deserializing of state between each execute ...
2
votes
1answer
1k views

Heap Size Limit: Can we split up Blobs?

Whilst parsing text files using Batch Apex, we retrieved an Heap Size error. The Heap Size limit happens before our custom Iterator. Because we parse an attachment, change it into a Blob and then ...
0
votes
1answer
1k views

Heap size limit when uploading file using Visualforce page

I have a visualforce page which has control. I am using this to upload a text file. I have property of type Attachment in my controller. Value of inpufile control will be Body of Attachment property. ...
2
votes
0answers
1k views

Difference between Apex Heap Size and JSON heap size

Helllo, I am getting a specific error of "JSON string exceeds heap size limit" . I can not find reference specific to JSON related to heap size. I know we have Email Heap size of 36 MB, while ...
3
votes
1answer
140 views

Do System.debug statements run in a Managed Package?

I know that the output is not visible, but do the statements actually execute? I have an exception thrown from a beta managed package (json string exceeds heap size limit) and the only time I'm using ...
4
votes
2answers
852 views

Heap size limit in Javascript Remoting method

I'm fairly sure that Remoting is Asynchronous. The docs state that the Apex heap size limit is 6Mb for a Synchronous op, and 12Mb for an Asynchronous op. However, from my RemoteAction (@Readonly) ...
3
votes
2answers
283 views

What is the importance of Heap size limit?

I don't understand the importance of heap size limit of 6MB. So could someone help me understand the heap size limit?
2
votes
1answer
966 views

Heap Size Limit in Salesforce

We have a mobile application which works with Salesforce. We want to support offline mode for this mobile application. For that when we are loading the application, we need to store all data in ...
1
vote
2answers
3k views

Getting heap size error while serializing collection of records in apex

I am suffering with Salesforce apex LimitException issue. I am fetching thousands of records from few objects and putting it into the collection like Map. Now I have a requirement to generate JSON for ...
4
votes
1answer
653 views

Does heap size limit affect VF pages with renderas=pdf

I recently ran into heap size limit, where I was having a list with over 1000 records. I resolved that by using the setcontroller for pagination. But now I need to render that page as PDF. When I ...
1
vote
0answers
220 views

How to solve the heap size issue in test classes

I created test class for Apex Class .test class code coverage 90% but I can't move from sandbox to production because an error is thrown regarding heaps size: Heap Size 6798787. What can I do to avoid ...
7
votes
5answers
1k views

Trying to LIMIT a SOQL Statement based upon projected Heap size

THE GOAL: Return as many rows as possible from a Remote method without hitting Heap limits. We have a Visualforce page calling into a @RemoteAction method in Apex to return sObjects to the page. The ...