Solved

Trying to understand App_Code folder issues. PLease explain.

Posted on 2013-12-03
3
262 Views
Last Modified: 2013-12-04
I am starting to build a new project in MS.NET C#, and I have a question:
Whatever classes are in the App_Code folder, does it load into a memory all at once, or does it load as a class is being referenced?
0
Comment
Question by:vituxa
  • 2
3 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 39692791
I think the following is what you are wanting:
When the app is executed the code in the app is loaded into memory.  (Don't forget it will require dll's from the .net runtime to run, so a 25 KB app will require more than 25 KBs of memory)
As the code runs then objects will be created which will take up more memory.

Put another way, say you have an app that when you press a button it will create 1,000 objects, each taking up 1,000 bytes of memory - but can only be pressed 5 times maximum.  Also say the app itself will take up 1,000,000 bytes of memory.
so now you start the app and 1,000,000 bytes of memory are in use.  Now you click the button and 2,000,000 bytes are in use.  Click the button again and now it is 3,000,000 bytes in use......


Also note that clicking the other button (not yet mentioned) that creates an object taking up 20,000,000 bytes means your app's memory usage never reaches that 20,000,000+ mark as long as you don't press it.


Does that explain what you wanted ?
0
 
LVL 1

Author Comment

by:vituxa
ID: 39692850
It's a bit complicated. I am debating whether I should use the ascx controls as I need them, or use classes in the App_Code. I want a more efficient way (to use as less memory as possible. I will have a massive project here). So, what would you suggest?
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 39692882
>>I want a more efficient way (to use as less memory as possible. I will have a massive project here). So, what would you suggest?

That you make a small project and look at the memory usage of each method.  That way you know for certain what the memory usage of each is.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now