devxlogo

Using <OBJECT> tag Instead of Server.CreateObject()

Using <OBJECT> tag Instead of Server.CreateObject()

When you create an object in ASP using the Server.CreateObject() method, the object is created as soon as the method is called. Any threads, memory, or other resources are allocated at the point of instantiation, or creation and thus the resources are held from that point onwards. However, you can create the object in such a way that it is not actually created until the first method or property of the new object is referenced. You can do this using the HTML tag with the Runat=Server attribute. The syntax for creating an object using the tag is:

 

This may not seem like a lot of savings. Still, while designing a system that has to withstand a high number of hits per day, it can be a consideration to keep in mind.

devx-admin

Share the Post: