How Aspose do the Memory Management.?

Hi Team,

Can you please brief me on how Aspose do the memory management.

Let take an example if we have to upload an sheet which has more than 1Lac records, to do so server will allocate the memory for an Workbook object and if at same time on webapplication if other used are also perfoming activity than does it will go to OutOfMemory. ?

Just wanted to know how Aspose object do the memory management.

Thanks in Advance.

Aspose Evaluation.

Hi Gurdeep,


Thank you for contacting Aspose support.

It is hard to answer your question briefly, however, as a general scenario Aspose.Cells require almost 10 times the memory of spreadsheet file size. For instance if the spreadsheet file size is 10MB then the required memory to completely load the spreadsheet for any operation is almost 100MB.

With recent releases of Aspose.Cells for .NET API, we have introduced the Memory Preferences, that can be used to lower the memory utilization while working with large spreadsheets such as the one mentioned by you. We would request you to please download and use the latest version of Aspose.Cells for .NET 8.1.1 with your actual file while employing the MemorySetting.MemoryPreference option. Moreover, please check the Public API Changes in Aspose.Cells 8.0.0 because this was the major release that has also changed the implementation of Cell & Row objects for performance considerations.

In case you face any difficulty, please feel free to write back with more details of your scenario/requirement.

Hi Team,

Is anything similar available for Java Cell API's.?

Thanks,

Gurdeep

Hi Gurdeep,


Very sorry for not noticing that you are using the Java version of the Aspose.Cells API. Yes, there is same mechanism available in Aspose.Cells for Java. Please check the detailed article on Memory Preferences & Public API Changes in 8.0.0 for your reference. You may put this concept to test with the latest version of Aspose.Cells for Java 8.1.0.

Please feel free to write back in case you face any difficulty.

Hi,

Can you please give a little more detail on how Memory Preference works internally. On how it optimizes the memory?

options.setMemorySetting(MemorySetting.MEMORY_PREFERENCE);

Previously, you had mentioned that Aspose will utilize about 100MB to read a file of 10MB. If we use the MEMORY_PREFERENCE option for the same 10MB file, how much of a difference will be there in the utilized memory.

Also, In one of your links its been mentioned this option may degrade performance in some special cases such as accessing cells randomly and repeatedly. How much of a impact will it be having on performance? Will it degrade considerably ?

Thanks.

Hi Gurdeep,


MemorySetting is used by cells data model to determine how to hold the cell data in memory. For MEMORY_PREFERENCE mode, cell data is saved in binary format in a complicated structure. Accessing the cell objects requires operations such as searching, boxing/un-boxing and so on, so the time cost will be much greater than the NORMAL mode. In some situations, such as randomly access/create/update large amount of cells, time cost may be nearly 2 times of NORMAL mode. However, when accessing cells sequentially(one by one in one row and row by row in ascending order), you can get better performance.

Please note, the memory cost not only depends on the size of the template file, but also on the data/datatype saved in it. If most of cells contain string or formula values, you may get little benefit from MEMORY_PREFERENCE mode. If most of cells are blank or contain simple value such as BOOLEAN, NUMERIC and so on, MEMORY_PREFERENCE mode may decrease the memory cost efficiently, sometimes even more than 50%.

Hope all your concerns are addressed.