Out of memory: 'Server.CreateObject'

Discussion in 'ASP General' started by Peter Koller, Jul 22, 2003.

  1. Peter Koller

    Peter Koller Guest

    Hi group!

    I am getting the following error from my ASP application:
    Microsoft VBScript runtime error '800a0007'

    Out of memory: 'Server.CreateObject'



    It always (as far as i have observed) occurs when i try to create a new
    ADODB.connection object in my cCon helper function (opening a connection and
    returning it):

    Function cCon()
    Dim cnRet
    set cnRet = server.createobject("ADODB.Connection") 'This is where the
    error is thrown
    cnRet.connectionstring = GLB_CONSTR_DB
    cnRet.open
    Set cCon = cnRet
    End Function


    The page that errors will typically call this function 6- 10times from
    different functions which handle their connections in this way:

    Function Foo()
    dim Con ...
    Set con = cCon()
    .... function code
    con.close
    set con = nothing
    End Function

    All my recordsets are disconnected and also destroyed with .close and Set
    rst = nothing.

    I have tested the application on two seperate servers with the same result.

    Both machines had more than enough memory.

    I have also checked the application log to see if anything was logged, but
    there wasnt.

    Any one got ANY ideas on this one? I'm starting to get desperate!
     
    Peter Koller, Jul 22, 2003
    #1
    1. Advertising

  2. Peter Koller

    Peter James Guest

    Peter
    Looks to me like every time you call cCon() you create an object *cnRet* but
    it is never destroyed. In function foo() you create another object *con*
    which is destroyed on completion, but I doubt that that destruction will
    cascade back to *cnRet*.

    If it is not a rude question - why use a helper function to create an
    ADODB.connection object? It is a straightforward action unlike a Win32 API
    call for example.

    HTH

    Peter


    "Peter Koller" <> wrote in message
    news:...
    > Hi group!
    >
    > I am getting the following error from my ASP application:
    > Microsoft VBScript runtime error '800a0007'
    >
    > Out of memory: 'Server.CreateObject'
    >
    >
    >
    > It always (as far as i have observed) occurs when i try to create a new
    > ADODB.connection object in my cCon helper function (opening a connection

    and
    > returning it):
    >
    > Function cCon()
    > Dim cnRet
    > set cnRet = server.createobject("ADODB.Connection") 'This is where the
    > error is thrown
    > cnRet.connectionstring = GLB_CONSTR_DB
    > cnRet.open
    > Set cCon = cnRet
    > End Function
    >
    >
    > The page that errors will typically call this function 6- 10times from
    > different functions which handle their connections in this way:
    >
    > Function Foo()
    > dim Con ...
    > Set con = cCon()
    > .... function code
    > con.close
    > set con = nothing
    > End Function
    >
    > All my recordsets are disconnected and also destroyed with .close and Set
    > rst = nothing.
    >
    > I have tested the application on two seperate servers with the same

    result.
    >
    > Both machines had more than enough memory.
    >
    > I have also checked the application log to see if anything was logged, but
    > there wasnt.
    >
    > Any one got ANY ideas on this one? I'm starting to get desperate!
    >
    >
    >
    >
    >
    >
    >
     
    Peter James, Jul 22, 2003
    #2
    1. Advertising

  3. Peter Koller

    Peter Koller Guest

    Won't the local "pointer" cnRet be destroyed when it goes out of scope?
    Anyways, the reason for cCon() is lazyness, one line instead of three..

    I tried to "manually" open the connections in my functions without using
    cCon(), but i still error, atlhough this time when reading a session
    variable (i only have one session variable holding an int so its not that
    either).


    In perfmon i have at least 200mb of free memory at all times. The maximum
    amount of connections to my sql server is 6.




    "Peter James" <> skrev i melding
    news:bfiod4$e11$...
    > Peter
    > Looks to me like every time you call cCon() you create an object *cnRet*

    but
    > it is never destroyed. In function foo() you create another object *con*
    > which is destroyed on completion, but I doubt that that destruction will
    > cascade back to *cnRet*.
    >
    > If it is not a rude question - why use a helper function to create an
    > ADODB.connection object? It is a straightforward action unlike a Win32

    API
    > call for example.
    >
    > HTH
    >
    > Peter
    >
    >
    > "Peter Koller" <> wrote in message
    > news:...
    > > Hi group!
    > >
    > > I am getting the following error from my ASP application:
    > > Microsoft VBScript runtime error '800a0007'
    > >
    > > Out of memory: 'Server.CreateObject'
    > >
    > >
    > >
    > > It always (as far as i have observed) occurs when i try to create a new
    > > ADODB.connection object in my cCon helper function (opening a connection

    > and
    > > returning it):
    > >
    > > Function cCon()
    > > Dim cnRet
    > > set cnRet = server.createobject("ADODB.Connection") 'This is where the
    > > error is thrown
    > > cnRet.connectionstring = GLB_CONSTR_DB
    > > cnRet.open
    > > Set cCon = cnRet
    > > End Function
    > >
    > >
    > > The page that errors will typically call this function 6- 10times from
    > > different functions which handle their connections in this way:
    > >
    > > Function Foo()
    > > dim Con ...
    > > Set con = cCon()
    > > .... function code
    > > con.close
    > > set con = nothing
    > > End Function
    > >
    > > All my recordsets are disconnected and also destroyed with .close and

    Set
    > > rst = nothing.
    > >
    > > I have tested the application on two seperate servers with the same

    > result.
    > >
    > > Both machines had more than enough memory.
    > >
    > > I have also checked the application log to see if anything was logged,

    but
    > > there wasnt.
    > >
    > > Any one got ANY ideas on this one? I'm starting to get desperate!
    > >
    > >
    > >
    > >
    > >
    > >
    > >

    >
    >
     
    Peter Koller, Jul 22, 2003
    #3
  4. Peter Koller

    Peter James Guest

    Peter
    Perhaps you should read Aaron Bertrand's many posts on the subject of
    ADODB.connections, and look here http://www.aspfaq.com . The (sound)
    philosophy is to create your object *when* and *where* you need it, and then
    destroy it asap having used it. This is by far the most robust way, even if
    it means putting the same lines of code in many scripts.

    HTH

    Peter

    "Peter Koller" <> wrote in message
    news:...
    > Won't the local "pointer" cnRet be destroyed when it goes out of scope?
    > Anyways, the reason for cCon() is lazyness, one line instead of three..
    >
    > I tried to "manually" open the connections in my functions without using
    > cCon(), but i still error, atlhough this time when reading a session
    > variable (i only have one session variable holding an int so its not that
    > either).
    >
    >
    > In perfmon i have at least 200mb of free memory at all times. The maximum
    > amount of connections to my sql server is 6.
    >
    >
    >
    >
    > "Peter James" <> skrev i melding
    > news:bfiod4$e11$...
    > > Peter
    > > Looks to me like every time you call cCon() you create an object *cnRet*

    > but
    > > it is never destroyed. In function foo() you create another object

    *con*
    > > which is destroyed on completion, but I doubt that that destruction will
    > > cascade back to *cnRet*.
    > >
    > > If it is not a rude question - why use a helper function to create an
    > > ADODB.connection object? It is a straightforward action unlike a Win32

    > API
    > > call for example.
    > >
    > > HTH
    > >
    > > Peter
    > >
    > >
    > > "Peter Koller" <> wrote in message
    > > news:...
    > > > Hi group!
    > > >
    > > > I am getting the following error from my ASP application:
    > > > Microsoft VBScript runtime error '800a0007'
    > > >
    > > > Out of memory: 'Server.CreateObject'
    > > >
    > > >
    > > >
    > > > It always (as far as i have observed) occurs when i try to create a

    new
    > > > ADODB.connection object in my cCon helper function (opening a

    connection
    > > and
    > > > returning it):
    > > >
    > > > Function cCon()
    > > > Dim cnRet
    > > > set cnRet = server.createobject("ADODB.Connection") 'This is where

    the
    > > > error is thrown
    > > > cnRet.connectionstring = GLB_CONSTR_DB
    > > > cnRet.open
    > > > Set cCon = cnRet
    > > > End Function
    > > >
    > > >
    > > > The page that errors will typically call this function 6- 10times from
    > > > different functions which handle their connections in this way:
    > > >
    > > > Function Foo()
    > > > dim Con ...
    > > > Set con = cCon()
    > > > .... function code
    > > > con.close
    > > > set con = nothing
    > > > End Function
    > > >
    > > > All my recordsets are disconnected and also destroyed with .close and

    > Set
    > > > rst = nothing.
    > > >
    > > > I have tested the application on two seperate servers with the same

    > > result.
    > > >
    > > > Both machines had more than enough memory.
    > > >
    > > > I have also checked the application log to see if anything was logged,

    > but
    > > > there wasnt.
    > > >
    > > > Any one got ANY ideas on this one? I'm starting to get desperate!
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Peter James, Jul 22, 2003
    #4
  5. Peter Koller

    Mark Schupp Guest

    Follow-up

    Just checked the function I mentioned in my other post. It is different from
    yours in that we do not use an intermediate variable. Your function would
    look like:

    Function cCon()
    set cCon = server.createobject("ADODB.Connection")
    cCon.open GLB_CONSTR_DB
    End Function

    I don't think that this should make any difference but you might try it.

    --
    Mark Schupp
    --
    Head of Development
    Integrity eLearning
    Online Learning Solutions Provider

    http://www.ielearning.com
    714.637.9480 x17


    "Peter Koller" <> wrote in message
    news:...
    > Won't the local "pointer" cnRet be destroyed when it goes out of scope?
    > Anyways, the reason for cCon() is lazyness, one line instead of three..
    >
    > I tried to "manually" open the connections in my functions without using
    > cCon(), but i still error, atlhough this time when reading a session
    > variable (i only have one session variable holding an int so its not that
    > either).
    >
    >
    > In perfmon i have at least 200mb of free memory at all times. The maximum
    > amount of connections to my sql server is 6.
    >
    >
    >
    >
    > "Peter James" <> skrev i melding
    > news:bfiod4$e11$...
    > > Peter
    > > Looks to me like every time you call cCon() you create an object *cnRet*

    > but
    > > it is never destroyed. In function foo() you create another object

    *con*
    > > which is destroyed on completion, but I doubt that that destruction will
    > > cascade back to *cnRet*.
    > >
    > > If it is not a rude question - why use a helper function to create an
    > > ADODB.connection object? It is a straightforward action unlike a Win32

    > API
    > > call for example.
    > >
    > > HTH
    > >
    > > Peter
    > >
    > >
    > > "Peter Koller" <> wrote in message
    > > news:...
    > > > Hi group!
    > > >
    > > > I am getting the following error from my ASP application:
    > > > Microsoft VBScript runtime error '800a0007'
    > > >
    > > > Out of memory: 'Server.CreateObject'
    > > >
    > > >
    > > >
    > > > It always (as far as i have observed) occurs when i try to create a

    new
    > > > ADODB.connection object in my cCon helper function (opening a

    connection
    > > and
    > > > returning it):
    > > >
    > > > Function cCon()
    > > > Dim cnRet
    > > > set cnRet = server.createobject("ADODB.Connection") 'This is where

    the
    > > > error is thrown
    > > > cnRet.connectionstring = GLB_CONSTR_DB
    > > > cnRet.open
    > > > Set cCon = cnRet
    > > > End Function
    > > >
    > > >
    > > > The page that errors will typically call this function 6- 10times from
    > > > different functions which handle their connections in this way:
    > > >
    > > > Function Foo()
    > > > dim Con ...
    > > > Set con = cCon()
    > > > .... function code
    > > > con.close
    > > > set con = nothing
    > > > End Function
    > > >
    > > > All my recordsets are disconnected and also destroyed with .close and

    > Set
    > > > rst = nothing.
    > > >
    > > > I have tested the application on two seperate servers with the same

    > > result.
    > > >
    > > > Both machines had more than enough memory.
    > > >
    > > > I have also checked the application log to see if anything was logged,

    > but
    > > > there wasnt.
    > > >
    > > > Any one got ANY ideas on this one? I'm starting to get desperate!
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Mark Schupp, Jul 22, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page