Life Scope

  • Thread starter Thread starter Chan
  • Start date Start date
C

Chan

In MS' TimeTracker sample app, a middle-tier component BLL has a class
named TimeEntry. It's used in TimeEntry.aspx to remember a certain
state of an entry.

I must have missed something but just can not find a clue on its life
scope, as the more request for the page, the more resources used up
for this and eventually may impact the system. So, can any expert
explain,

1> what's the life scope of TimeEntry, and when it will be scraped?

2> how do we tell the GC not to touch it?

Thanks!
 
Chan said:
In MS' TimeTracker sample app, a middle-tier component BLL has a class
named TimeEntry. It's used in TimeEntry.aspx to remember a certain
state of an entry.

I must have missed something but just can not find a clue on its life
scope, as the more request for the page, the more resources used up
for this and eventually may impact the system. So, can any expert
explain,

1> what's the life scope of TimeEntry, and when it will be scraped?

I have not looked at the app, but here are some things to look at.

1. Is the cache through a static method? It could be eternal.
2. Does it also use Session ID to store (most likely)? Check Session_End for
clean up
2> how do we tell the GC not to touch it?

If you want to tell the GC hands off, you really cannot. But, you can set up
a static method to hold variables. As long as the app is running, the vars
will stay in memory and not be garbage collected, unless you delete the
values and allow the memory to be cleaned up.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
Thanks for the input.

1> There is no Session_End(). Is there a default place for
Session_End() in .NET?

2> The class is defined as "public", and it's created within the page
as

Protected _userInput As New BusinessLogicLayer.TimeEntry(0, 0, 0, 0,
DateTime.MinValue, Nothing, -1D)

So, it's not static either. Additionally, all it's New() constructor
are "public".
 
Back
Top