473,654 Members | 3,068 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Too many objects loaded at the same time and cause OutOfMemory exception.

I'm working on a .net web application. The architect of this web
application is quite different than other web applications i worked
before. Since we use a set of tools to generate most of the basic
code. Every table in the database related to an object in the
application. There is no stored procedures in database; In every
object of the application, the tool generates methods for basic
database operations like insert, delete, update, selete, and methods
to compose a select query inside the table(object)

But it definitly is a bad design, since we have more and more users,
big performance issues coming out when generating reports for users.
For example, if i use this architect for a school, i can easily create
objects of grade, class, student, lesson, semester, now let's say i
have 6 grades, each grade has 10 class, each class has 20 students,
each student has 5 lessons. If i want to generate a score report for
all students's score in fall of 2006, i have to first load grade
object collection, loop into grade collection; load class object
collection, loop into class collection; load student object
collection, loop into student collection; load lesson object
collection, loop into lesson collection. I don't know how .net garbage
collection will work on this situation, whether or not it does load
all 6x10x20x5=6000o bjects in memory at the same time. I noticed a huge
memory overhead for aspnet_ws process, then i got Service Unavailable
error in my browser, and the memory of aspnet_ws back to normal.

Does anyone know how .net framework works on my situation? Any
resolution to this OutOfMemory issue except using stored procedure? I
don't think asynchronized process will help, what do you think? What's
the best way to scale out for the current system?

thank you for your help,
-Elaine

Jan 30 '07 #1
2 1385
Elaine,
Stored procedures won't necessarily help here, they would simply
push the select and other data access mechanisms onto the database server,
though they will improve the speed of the queries slightly since they will
allow the database to pre-plan the implementation. Stored Procedures will
also drastically improve your security since they promote parametrized
queries and help avoid SQL Injection attacks. You're still stuck with the
application design overall. It seems to be a rather cumbersome design to say
the least. There should be a way to load objects without having to load all
of these collections. I think a better, more direct approach would need to
be taken. This would make sense if you were drilling down into a data
wherehouse and using a pivot table and incrementally loading data as needed.

The garbage collection should occur sometime after the page unloads.
You can attempt to speed it up by calling the dispose method on the
collections (if available) and then setting them to null. I don't think this
architecture will work very well as it doesn't sound very stable at all. You
should be able to create functionality to get this sort of data directly
from the db as there should be no need to call all these objects just get
the results of what should be a common type of sql query.

--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"elaine" <el*******@gmai l.comwrote in message
news:11******** **************@ h3g2000cwc.goog legroups.com...
I'm working on a .net web application. The architect of this web
application is quite different than other web applications i worked
before. Since we use a set of tools to generate most of the basic
code. Every table in the database related to an object in the
application. There is no stored procedures in database; In every
object of the application, the tool generates methods for basic
database operations like insert, delete, update, selete, and methods
to compose a select query inside the table(object)

But it definitly is a bad design, since we have more and more users,
big performance issues coming out when generating reports for users.
For example, if i use this architect for a school, i can easily create
objects of grade, class, student, lesson, semester, now let's say i
have 6 grades, each grade has 10 class, each class has 20 students,
each student has 5 lessons. If i want to generate a score report for
all students's score in fall of 2006, i have to first load grade
object collection, loop into grade collection; load class object
collection, loop into class collection; load student object
collection, loop into student collection; load lesson object
collection, loop into lesson collection. I don't know how .net garbage
collection will work on this situation, whether or not it does load
all 6x10x20x5=6000o bjects in memory at the same time. I noticed a huge
memory overhead for aspnet_ws process, then i got Service Unavailable
error in my browser, and the memory of aspnet_ws back to normal.

Does anyone know how .net framework works on my situation? Any
resolution to this OutOfMemory issue except using stored procedure? I
don't think asynchronized process will help, what do you think? What's
the best way to scale out for the current system?

thank you for your help,
-Elaine

Jan 30 '07 #2

Hi Mark,
Thank you for your response.

First, I think Stored procedures will help me here, as you said in
your post "You
should be able to create functionality to get this sort of data
directly
from the db as there should be no need to call all these objects just
get
the results of what should be a common type of sql query. ", I think
stored procedure can do it for me. The reason i don't want to use
stored procedure here is this system is not small, each report might
need over 20 objects involved, i have to write complex stored
procedures. And besides reports, i think later on, other
functionalities might have the same issue as reporting, if i choose to
use stored procedures to feed all my need, it seems like i need to
rewrite the whole application.

I will try to add dispose method in the loops to see if this will
work.

I'm also interested in the way you mentioned "This would make sense if
you were drilling down into a data
warehouse and using a pivot table and incrementally loading data as
needed. ", can you give me some references to check about how to use
data warehouse in my case?"

Thanks again for your help.
-Elaine

On Jan 29, 5:05 pm, "Mark Fitzpatrick" <markf...@fitzm e.comwrote:
Elaine,
Stored procedures won't necessarily help here, they would simply
push the select and other data access mechanisms onto the database server,
though they will improve the speed of the queries slightly since they will
allow the database to pre-plan the implementation. Stored Procedures will
also drastically improve your security since they promote parametrized
queries and help avoid SQL Injection attacks. You're still stuck with the
application design overall. It seems to be a rather cumbersome design to say
the least. There should be a way to load objects without having to load all
of these collections. I think a better, more direct approach would need to
be taken. This would make sense if you were drilling down into a data
wherehouse and using a pivot table and incrementally loading data as needed.

The garbage collection should occur sometime after the page unloads.
You can attempt to speed it up by calling the dispose method on the
collections (if available) and then setting them to null. I don't think this
architecture will work very well as it doesn't sound very stable at all. You
should be able to create functionality to get this sort of data directly
from the db as there should be no need to call all these objects just get
the results of what should be a common type of sql query.

--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"elaine" <elain....@gmai l.comwrote in messagenews:11* *************** ******@h3g2000c wc.googlegroups .com...
I'm working on a .net web application. The architect of this web
application is quite different than other web applications i worked
before. Since we use a set of tools to generate most of the basic
code. Every table in the database related to an object in the
application. There is no stored procedures in database; In every
object of the application, the tool generates methods for basic
database operations like insert, delete, update, selete, and methods
to compose a select query inside the table(object)
But it definitly is a bad design, since we have more and more users,
big performance issues coming out when generating reports for users.
For example, if i use this architect for a school, i can easily create
objects of grade, class, student, lesson, semester, now let's say i
have 6 grades, each grade has 10 class, each class has 20 students,
each student has 5 lessons. If i want to generate a score report for
all students's score in fall of 2006, i have to first load grade
object collection, loop into grade collection; load class object
collection, loop into class collection; load student object
collection, loop into student collection; load lesson object
collection, loop into lesson collection. I don't know how .net garbage
collection will work on this situation, whether or not it does load
all 6x10x20x5=6000o bjects in memory at the same time. I noticed a huge
memory overhead for aspnet_ws process, then i got Service Unavailable
error in my browser, and the memory of aspnet_ws back to normal.
Does anyone know how .net framework works on my situation? Any
resolution to this OutOfMemory issue except using stored procedure? I
don't think asynchronized process will help, what do you think? What's
the best way to scale out for the current system?
thank you for your help,
-Elaine- Hide quoted text -- Show quoted text -
Jan 30 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5439
by: Mike Schilling | last post by:
Instances of SystemOutOfMemoryException do not contain a stack trace. Easy test to verify this: class OOM { public static void Main() { try { Object arr = new Object; } catch (Exception ex) { dumpEx(ex);
38
3718
by: Radi Radichev | last post by:
Hi! I'm making a database application and i heard from a friend that it is more proffecional and easy to do this with bussines objects. Can anyone tell me where i can find more info on bussines objects and how to implement them with c#? I would appreciate any help. Thanks.
2
1759
by: Ricky Chan | last post by:
Windows Server 2003 with 2G Ram ,IIS6 -> I have enabled /3gb switch in boot.ini ! -> Machine.config set to 80% memory Limit However, It still throw outofmemory exception when loading large amount of data.
1
1921
by: Ricky Chan | last post by:
In the production environment, it always occurs and the worker process did not recycle automatically. Therefore, it make the system service break to client. In development environment, we write a program to loop sth and force outofmemory throw. however, when the w3wp exceed physical mem, the process recycle automatically, no outofmemory throw. Any idea? thank you
2
7871
by: Peter S. | last post by:
I am pulling some data from a source via ODBC and placing the information in a DataSet. The first pull is very large but once that is complete I plan to do nightly pulls to get any new data that gets put in the (remote) table. I can't seem to get past that initial (big) pull of data, as I get OutOfMemory exceptions. I took a look back at when this occurs and it seems to happen upon stuffing the DataSet with either the 2097153 record or...
3
2912
by: Nemisis | last post by:
Hi everyone, Can someone please tell me why my code hits an "out of memory exception" on the below code? All the code does is load some documents from a SQL database and loop through a data reader to create a thumbnail image for each image in my dataReader. The error only occurs when i have more then 3 images in my DataReader.
4
5817
by: ThunderMusic | last post by:
Hi, I have a custom form that works fine when I debug it or run it in release mode but cannot be loaded in the designer... Actually, it can be loaded in the designer when no control is on it, but the resizing tool (in the designer) is offset both horizontally and vertically and when I put a control on it, as soon as I save, the designer throws an exception (but cannot be reproduced everytime) and the form cannot be loaded anymore unless...
5
3636
by: Jonathan Boivin | last post by:
Hi, I've got some problems with loading bills using a bill usercontrol I built. If I load all current bills in my test environment (156) everything is fine once, but repeating the operation (which clear all the bills and reshow all of them) four to five times and I get a Error creating window handle. I investigated on all of this, a lot, and still I'm not able to find where this problem come from. I know that the GDI objects column in...
0
1455
by: doobybug | last post by:
Hi all, I really need your help! I am new to java and have some problems with my code. I have a program which inputs questionnaires and creates an object for each questionnaire. These objects are then saved in a vector which in turn is then encoded in an XML file. For all this I have made a class called MainInput. The problem is with MainOutpu class. I want to make a class that prints the questionnaires in alphabetical order (which is already...
0
8285
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8814
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8706
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8475
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8591
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4293
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2709
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.