Free Support Forum -

Huge performance issues when using ASPOSE

I was having huge performance issues with a page using ASPOSE grid. An analysis of the memory dump obtained from the site (pasted below my message) shows that there are 226327 objects in gen 2 of the GC.

Most of the objects in there look like ASPOSE related

For example:

Aspose.Grid.Web.TableItemStyle Total Size: 57139448

System.Web.UI.WebControls.TableItemStyle Total Sise: 807840 (not from ASPOSE but probably related to the entry above as there are no other tables on the page)

Can anyone from the ASPOSE team look at this? This entirely blocks all the users and the site just drags... This is a high priority item for us...





Heap 0

generation 0 has 0 finalizable objects (000000000f16a0f8->000000000f16a0f8)

generation 1 has 0 finalizable objects (000000000f16a0f8->000000000f16a0f8)

generation 2 has 226327 finalizable objects (000000000efb0040->000000000f16a0f8)

Ready for finalization 0 objects (000000000f16a0f8->000000000f16a0f8)


Heap 1

generation 0 has 8 finalizable objects (000000000efa1938->000000000efa1978)

generation 1 has 0 finalizable objects (000000000efa1938->000000000efa1938)

generation 2 has 205599 finalizable objects (000000000ee10040->000000000efa1938)

Ready for finalization 0 objects (000000000efa1978->000000000efa1978)


MT Count TotalSize Class Name

00000642788322c8 1 24 System.Threading.OverlappedDataCache

00000642788a5430 1 32 System.Security.Cryptography.SafeHashHandle

0000064278827c00 1 32 System.LocalDataStoreSlot

0000064274e516f8 1 32 Microsoft.Win32.SafeHandles.SafeProcessHandle

00000642bcea6b98 1 40 System.Web.ClientImpersonationContext

0000064280770c00 1 40 Microsoft.Office.Server.Diagnostics.SharedServicesPerfmonManager

0000064278832248 1 40 System.Threading.OverlappedDataCacheLine

00000642bced75e0 2 48 System.Web.Configuration.ImpersonateTokenRef

00000642bcf27df8 1 64 System.Web.Util.ResourcePool

00000642bce94c28 2 64 System.Web.PerfInstanceDataHandle

00000642b77f6fa8 2 64 Bid+AutoInit

0000064274eae390 2 64 System.Net.SafeLocalFree

00000642bceb0e98 1 80 System.Web.UI.WebControls.TableStyle

0000064278833140 2 80 System.Threading.RegisteredWaitHandleSafe

00000642788a52c0 3 96 System.Security.Cryptography.SafeProvHandle

0000064278863f80 3 96 Microsoft.Win32.SafeHandles.SafeFileHandle

0000064274e745a8 2 96 Microsoft.CSharp.CSharpCodeProvider

00000642bce99e60 2 112 System.Web.Compilation.CompilationMutex

00000642b77fa540 2 112 System.Data.SqlClient.SNILoadHandle

0000064274eaed20 2 112 System.Net.SafeDeleteContext_SECURITY

0000064274eaef60 3 120 System.Net.SafeCloseSocket

00000642788642f0 4 128 Microsoft.Win32.SafeHandles.SafeViewOfFileHandle

0000064278864188 4 128 Microsoft.Win32.SafeHandles.SafePEFileHandle

0000064278864030 4 128 Microsoft.Win32.SafeHandles.SafeFileMappingHandle

0000064274e71bf8 4 128 Microsoft.Win32.SafeHandles.SafeFileMapViewHandle

0000064274e71aa8 4 128 Microsoft.Win32.SafeHandles.SafeFileMappingHandle

00000642b77fffb0 2 144 System.Data.DataViewManager

0000064275d14648 3 144 System.Drawing.Bitmap

00000642b77fab70 5 160 System.Data.SqlClient.SNIPacket

0000064274eaf2d0 4 160 System.Net.SafeRegistryHandle

00000642806d00c0 1 168 Microsoft.SharePoint.Administration.SPConfigurationDatabase+SPFileSystemCacheWatcher

0000064274eaf138 4 192 System.Net.SafeCloseSocketAndEvent

0000064274eaf040 6 192 System.Net.SafeCloseSocket+InnerSafeCloseSocket

00000642b77fa960 5 200 System.Data.SqlClient.SNIHandle

00000642b77f3a70 2 208 System.Data.SqlClient.SqlConnection

0000064274eb0c60 3 240 System.Net.Sockets.NetworkStream

0000064274eb0ee8 2 256 System.Net.TlsStream

00000642b77f9980 3 264 System.Data.ProviderBase.DbConnectionPool+PoolWaitHandles

0000064274eae950 7 280 System.Net.SafeCredentialReference

00000642bcf5c918 6 288 System.Web.Security.FileSecurityDescriptorWrapper

0000064278886208 3 312 System.Runtime.Remoting.Contexts.Context

0000064274eb73d0 3 336 System.Net.Sockets.Socket

0000064274eaea00 7 336 System.Net.SafeFreeCredential_SECURITY

0000064278882bf8 11 352 Microsoft.Win32.SafeHandles.SafeTokenHandle

00000642bce959e8 9 360 System.Web.ApplicationImpersonationContext

00000642bcf28220 5 400 System.Web.UI.WebControls.PanelStyle

0000064278864238 14 448 Microsoft.Win32.SafeHandles.SafeRegistryHandle

00000642b77fbe20 3 552 System.Data.DataSet

00000642788328a8 7 728 System.Threading.Thread

00000642788340f0 21 840 System.Threading.TimerBase

00000642b77f4030 4 896 System.Data.SqlClient.SqlCommand

0000064274ea9c30 3 936 System.Net.Connection

00000642bce95eb8 17 952 System.Web.DirMonCompletion

00000642788643a0 34 1088 Microsoft.Win32.SafeHandles.SafeWaitHandle

0000064278832460 17 1088 System.Threading.ReaderWriterLock

00000642b77feb30 7 1288 System.Data.DataView

00000642804728c0 11 1320 Aspose.Grid.Web.TableStyle

00000642bceb0128 24 1920 System.Web.UI.WebControls.Style

0000064278832060 16 1920 System.Threading.OverlappedData

000006427882fe08 153 4896 System.WeakReference

00000642b77fcfb0 10 5120 System.Data.DataTable

0000064274e70050 40 6720 System.Diagnostics.PerformanceCounter

00000642b77fe2f0 71 16472 System.Data.DataColumn

00000642bcef4720 1094 43760 System.Web.HttpResponseUnmanagedBufferElement

00000642bceb03e8 10098 807840 System.Web.UI.WebControls.TableItemStyle

0000064280474480 420143 57139448 Aspose.Grid.Web.TableItemStyle

Total 431934 objects


We will look into it. Which version of Aspose.Grid.Web you are using? Could you give us some more details: e.g., your Server Environment, OS, IIS, .NET framework etc.

Thank you.

Our Environment i as follows:

Windows 2003 Server 64bit

.Net Framework 2.0

IIS 6.0

We do have alarge amount of data being loaded in the grid - 5000 Rows times 70 columns, but performance is still bad with 1/5th of that data.

FYI - Our session is stored in SQL Server and we dont plan to use and sessions for the grid data.

I dont have a load balancer right now but so much Gen 2 objects are a big concern, I am just a week away from going live and signoffs and this has really fallen bad in our plate. Any resolution around this will be of great help and the sooner we can get some suggestions the better it will be.



Frist, please upgrage to the latest version This version fixed a problem of style object.

5000 rows and 70 columns, that means the grid contains 350,000 cells. If you set styles for each cell, 350,000 TableItemStyle objects will be generated. I suggest to create Grid styles for the grid, use the GridWeb.CustomStyleFileName property, and use the GridWeb Designer to create the style file. And only set styles for the different cells. That will save a lot of memory.

And, do you save the grid's session data in sql? For large amount of data, that will be hign cost, for the grid will serialize and deserialize the data upon each request.

We will keep on our work at optimizing the product. Thank you.

I am going to try this version since I was having similar issues…

Please let me know your findings, I had to replace the Grid with the regular .Net grid where ever I don’t need it becasue of these performance issues.


As you know, large data processing is a great challenge in web programing. But there are still some ways to make it easy.

By default, the grid will cache all sheet cells data in session. That means all cell objects will be hold for each user. The benefit of this behavior is that it makes the editing be easier. The grid will not have to load data from database, file, etc. It just load data from session in the subsequent request. So, if you just want to display the datagrid, and you don't want to modify the data, you may disable the grid's session mode. Just add the following code:

GridWeb1.EnableSession = false;
GridWeb1.EnableViewState = false;


Note: you will have to load or bind data for the grid upon each request in the Page_Load handler.

About TableItemStyle object issue, there is a way to reduce the number of the instance. WebCell.Style property is writable. If you sheet contains large number of cells that have the same style, you may build a style object and assign it to all the cells.

Aspose.GridWeb.TableItemStyle style = new Aspose.Grid.Web.TableItemStyle();

// set the style's values

style.Color = ...


// in a loop

cell.Style = style;

Wish this helps.

Thank you.

We did do the following

GridWeb1.EnableSession = false;

and got a outofmemory exception :(, we also ran into some serialization issues with regards to SQL.



Set the EnableSession to false will let the control use ViewState to save data. Then the control will serialize the WebWorksheets object. That will eat too much memory with large sheet. So you should add this line too to prevent the serialization:

GridWeb.EnableViewState = false;

OK - So I have done both the viewstate and session state to false. My grid is editable and I want to persist the changes done by the user, how could I go about doing that with importdataview? Also I couldn;t find the LoadCustomData method anywhere which in some of your documents seems like a way to deal with this.

A quick response will be highly appreciated as we are close to production and are hung becasue of these issues.


Can somebody please reply on this, this is extremely urgent for us. I want a editable grid without viewstate or sessions as mentioned in the post. If I dont disbale those the grid is just eating too much memory. I have a huge app which is wating a fix around this before going live, looks like memory issues…


We will get back to you soon.

Thanks for being patient!

Thanks - this is really critical I have a multi million dollar app which can not go in production unless this issue is resolved.

What I want is just with both viewstate and sessionstate to false, I should be able to read the Grid contents on the server and deal with that data. Please get back to me ASAP.

thanks again

Guys - you beleive it or not but I am really desperate to get an answer to this problem I am facing. Please get back to us ASAP. I dont see any other way of support here except this forum. Pleassssseeee Help.



How do you load data to the sheet? From file or database? If you don't want to use session or viewstate to store the sheet data, you should mantain the sheet's state manually. We have removed the "LoadCustomData" frome version 1.9.1 and later versions because we think it was seldom used. Now we will add this event again, and you may handle this event to load data from file or database before the sheet could be updated.

Thank you for your patient.

The data is being loaded from a database. I understand that the data has to be persisted manually, this could work for a readonly grid. I have a grid that is being loaded from the db and could be updated on the client. How do I retrieve the data entered by the user when viewstate is turned off?

Please try the attachment v1.9.2.2,
We've made some changes in this version.
The EnableSession property is obsoleted. Please use the new SessionMode property instead.
Set SessionMode = SessionMode.Custom to manually mantain the session.
Please notice that the GridWeb.EnableViewState should be always set to true whatever the session mode you plan to use.

Here is an example for manually mantain the session:

private void Page_Load(object sender, System.EventArgs e)
if (!IsPostBack)
GridWeb1.SessionMode = SessionMode.Custom;
// Loads the initial data, from file or database.

// Saves the session data.

private void GridWeb1_SheetDataUpdated(object sender, System.EventArgs e)
// Handles the SheetDataUpdated event.
// Saves the session data for each update.

private void GridWeb1_LoadCustomData(object sender, System.EventArgs e)
// Handles the LoadCustomData event.
// Loads the session data.

You may use the Session.SessionID as a part of the session data file's name in multi-users environment.
You may do the real updating(to database, etc.) in another event, for an example, SubmitCommand.

the thng is I dont want session and viewstate at all, as soon as I enable viewstate the memory consumption is too high on the IIS server and the server eventualy comes to a crawl. I want to avoid using viewstate.


This new version has 3 session mode: Session, ViewState and Custom. You may use GridWeb.SessionMode property to choose the session mode you want. With Custom mode, the grid doesn't save the sheet data to Session or ViewState. And it gives you a chance to manipulate the session by yourself.

If you just want to display data and don't want to edit them, you may set the SessionMode to "SessionMode.Custom" and ignore anything about session. But you should load the grid's data in the Page_Load event for each request, or you will find that the grid becomes empty when you click a button.

If you want to edit the grid's content in Custom SessionMode, you should recover the grid's data state in each request before the post data updates the grid. My last post gives an example of custom session mode using a temp file. The first time the grid loads data, it save its content to an "AGW2" format file. And in the LoadCustomData event, it loads data from the "AGW2" file. And each time the grid's data is updated, it saves the newest content back to the "AGW2" file in the SheetDataUpdated event. So we keep the grid's session state in a temp file, without any cost of Memory.

Please try this mode. Thank you.

We have passed through this hurdle by customizing our usage, my only feedback will be that you should run perfmon when you are doing databinds to check the memory allocation with this grid, you will actually see that the Grid allocates a lot of objects on Large Object Heap which is a big problem as that heap eventually gets fragmented and we loose memory becaue the fragments cant be reallocated. Alos our dataset is huge but I have worked extensively on this Grid now and the problem is the usage of Large Object Heap. I think you should further optimize this as we have ran into a lot of performance issues.

You can take this our feedback about your product.