Server.CreateObject Vs CreateObject

S

Sagar

I am working on a project where Server.CreateObject is replaced with
CreateObject all over the project. Though I know that this will
improve performance in terms of Memory overlhead because of how the
object creation happens with Server.CreateObject, I would like to
create 'visible scenarios' that i create with code to show people that
'"look. here's the difference". Is it possible ?

I will create a page with 2 calls, 1 with Server.CreateObject and 1
with CreateObject, run the code and see the difference. Any thoughts ?


Thanks.
Anand.
 
A

Anthony Jones

Sagar said:
I am working on a project where Server.CreateObject is replaced with
CreateObject all over the project. Though I know that this will
improve performance in terms of Memory overlhead because of how the
object creation happens with Server.CreateObject, I would like to
create 'visible scenarios' that i create with code to show people that
'"look. here's the difference". Is it possible ?

I will create a page with 2 calls, 1 with Server.CreateObject and 1
with CreateObject, run the code and see the difference. Any thoughts ?

I've never heard of any significant memory usage difference between the two
and I find it difficult to see what might be the cause of such a difference.

The only real difference between the two is handling of OnStartPage and
OnEndPage methods on the classes default interface.

When using Server.CreateObject after the object is instanced ASP looks for
the OnStartPage method on the returned interface, if found it is called with
the current script context as a parameter.

This handling does not occur for CreateObject. However, since IIS 5.0 ASP
runs as a COM+ context and components can implement IObjectContext through
which the scripting context can be discovered. This approach works whether
the Server version is used or not.

Personally I still implement OnStartPage since its a lot less faff but it
does require the use of Server.CreateObject.
 
S

Sagar

Not really. I have read in other sites that there IS a difference.

With Server.CreateObject, the object instance is created with the
context of transaction
With CreateObject, the obect is created without any context.

Let me know if this is incorrect.

and Is there a way to demo these scenarions and some simple code ?

Thanks,
Anand.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top