After creating a custom file-uploader lightning component we had the following problem :
- The amount of data to be passed from lightning controller to server-side controller (apex) was limited (around 3 MB).
Solution
- We have implemented the component on a sandbox org.
To solve the problem , we pass the data in chunks which are smaller than 3 MB and we use the 6 MB heap memory from apex to append the chunks together.
The approached solution works fine on the sandbox, as long the total size of all chunks is smaller than 6 MB (Because of the heap's limit => 6MB).
Deployment to production org :
- After we deployed the component to the production org , we tested the component and we got a strange result.
- We got a System.LimitsException (Which of course can't be caught). In the following image is the exception :
What we cant understand is that the file is only 3.74MB and not (~ 8MB). Also I don't think that the problem is in the performance of the code (or the usage of memory) because we used the exact same component on the sandbox and uploaded the exact file and it worked just fine.
Is there any difference between the heap consumption on production org and sandbox? if the answer is no , what can cause such a problem?