[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Trying to understand App_Code folder issues. PLease explain.

Posted on 2013-12-03
3
Medium Priority
?
300 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 45

Accepted Solution

by:
AndyAinscow earned 2000 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 45

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

830 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