Click here to Skip to main content
15,885,868 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good morning.
I have a question about the article WPF: Data Virtualization .

I read the article and it was very interesting and very useful for my project.
It is a great way to view the data.
I am using it to read, one hundred and ninety thousand data from my database.
But sometimes, when I read this data inside my GUI, and I'm going to read rows, I get an error saying:

Exception error nell'UIThread
"System.OurOfMemoryException"

Before the error, I realized, through a line counter in the GUI,
that does not read all the data in the database, but stops about thirty-seven thousand lines.
After that when I go down with the scrollbar, then appears the error message.
What could cause this kind of error?

I hope u could help me with some advice
Regards
Marco
Posted
Updated 26-May-15 0:10am
v2
Comments
Leo Chapiro 26-May-15 7:01am    
It is difficult without to see the corresponding source code of you. May be is caused by inappropriate variable (overflow) - who know's?
Member 11485245 26-May-15 8:39am    
But an overflow can be generate a this kind error?
OutOfMemoryException is caused by busy computer memory?
johannesnestler 26-May-15 8:45am    
so something is wrong with your "data virtualization", it seems you are holding to much item's in Memory. This contradicts your need for virtualization, your implementation seems to have a bug... But which?
Your description of the problem is a little confusing to me: "stops about 37k lines...", how many item's does your virtual cache contain??? 37k?
Member 11485245 26-May-15 9:13am    
My database contain 190000 rows.
But it reads only 37000rows and under this i have empty rows.
johannesnestler 26-May-15 9:35am    
so your data-virtalization isn't working at all? Seems to me like 37000 rows fit into memory and after that you are out of memory. So your virtualization technique should hold a lot less items in memory at any given time - I'd say you have a bug and your vitualization is either wrong or not working. So how many items do you "think" you Cache? Is your code to release/recycle the cached items correct... Hard to give an advise but these are the areas I would look first.

1 solution

This is because you are using low configuration machine that donot have ability to manage your huge data.
Instead of Virtualization on UI side in WPF you can use OFFSET - FETCH keywords introduced in SQL Server 2012.
Your can also go by following sql query
Where you can make a range by selecting specific 100,200 or n numbers so that your application does not shows Out of Memory Exception.
SQL
SELECT
        ROW_NUMBER() OVER(ORDER BY Barcode) AS RowNumber, *
     FROM
        AllBarcode AS tbl
WHERE RowNumber>= @StartFrom AND RowNumber<= @EndNumber
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900