Out of memory: 'Server.CreateObject'

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Koller

    Out of memory: 'Server.CreateObject'

    Hi group!

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

    Out of memory: 'Server.CreateO bject'



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

    Function cCon()
    Dim cnRet
    set cnRet = server.createob ject("ADODB.Con nection") 'This is where the
    error is thrown
    cnRet.connectio nstring = 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

    #2
    Re: Out of memory: 'Server.CreateO bject'

    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.connectio n object? It is a straightforward action unlike a Win32 API
    call for example.

    HTH

    Peter


    "Peter Koller" <peter.koller@s ysteam.no> wrote in message
    news:eytYlfBUDH A.2648@TK2MSFTN GP10.phx.gbl...[color=blue]
    > Hi group!
    >
    > I am getting the following error from my ASP application:
    > Microsoft VBScript runtime error '800a0007'
    >
    > Out of memory: 'Server.CreateO bject'
    >
    >
    >
    > It always (as far as i have observed) occurs when i try to create a new
    > ADODB.connectio n object in my cCon helper function (opening a connection[/color]
    and[color=blue]
    > returning it):
    >
    > Function cCon()
    > Dim cnRet
    > set cnRet = server.createob ject("ADODB.Con nection") 'This is where the
    > error is thrown
    > cnRet.connectio nstring = 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[/color]
    result.[color=blue]
    >
    > 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!
    >
    >
    >
    >
    >
    >
    >[/color]


    Comment

    • Peter Koller

      #3
      Re: Out of memory: 'Server.CreateO bject'

      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" <owp777@yahoo.c o.uk> skrev i melding
      news:bfiod4$e11 $1@codas.jet.uk ...[color=blue]
      > Peter
      > Looks to me like every time you call cCon() you create an object *cnRet*[/color]
      but[color=blue]
      > 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.connectio n object? It is a straightforward action unlike a Win32[/color]
      API[color=blue]
      > call for example.
      >
      > HTH
      >
      > Peter
      >
      >
      > "Peter Koller" <peter.koller@s ysteam.no> wrote in message
      > news:eytYlfBUDH A.2648@TK2MSFTN GP10.phx.gbl...[color=green]
      > > Hi group!
      > >
      > > I am getting the following error from my ASP application:
      > > Microsoft VBScript runtime error '800a0007'
      > >
      > > Out of memory: 'Server.CreateO bject'
      > >
      > >
      > >
      > > It always (as far as i have observed) occurs when i try to create a new
      > > ADODB.connectio n object in my cCon helper function (opening a connection[/color]
      > and[color=green]
      > > returning it):
      > >
      > > Function cCon()
      > > Dim cnRet
      > > set cnRet = server.createob ject("ADODB.Con nection") 'This is where the
      > > error is thrown
      > > cnRet.connectio nstring = 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[/color][/color]
      Set[color=blue][color=green]
      > > rst = nothing.
      > >
      > > I have tested the application on two seperate servers with the same[/color]
      > result.[color=green]
      > >
      > > Both machines had more than enough memory.
      > >
      > > I have also checked the application log to see if anything was logged,[/color][/color]
      but[color=blue][color=green]
      > > there wasnt.
      > >
      > > Any one got ANY ideas on this one? I'm starting to get desperate!
      > >
      > >
      > >
      > >
      > >
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Peter James

        #4
        Re: Out of memory: 'Server.CreateO bject'

        Peter
        Perhaps you should read Aaron Bertrand's many posts on the subject of
        ADODB.connectio ns, 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" <peter.koller@s ysteam.no> wrote in message
        news:OkIaLZCUDH A.2036@TK2MSFTN GP10.phx.gbl...[color=blue]
        > 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" <owp777@yahoo.c o.uk> skrev i melding
        > news:bfiod4$e11 $1@codas.jet.uk ...[color=green]
        > > Peter
        > > Looks to me like every time you call cCon() you create an object *cnRet*[/color]
        > but[color=green]
        > > it is never destroyed. In function foo() you create another object[/color][/color]
        *con*[color=blue][color=green]
        > > 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.connectio n object? It is a straightforward action unlike a Win32[/color]
        > API[color=green]
        > > call for example.
        > >
        > > HTH
        > >
        > > Peter
        > >
        > >
        > > "Peter Koller" <peter.koller@s ysteam.no> wrote in message
        > > news:eytYlfBUDH A.2648@TK2MSFTN GP10.phx.gbl...[color=darkred]
        > > > Hi group!
        > > >
        > > > I am getting the following error from my ASP application:
        > > > Microsoft VBScript runtime error '800a0007'
        > > >
        > > > Out of memory: 'Server.CreateO bject'
        > > >
        > > >
        > > >
        > > > It always (as far as i have observed) occurs when i try to create a[/color][/color][/color]
        new[color=blue][color=green][color=darkred]
        > > > ADODB.connectio n object in my cCon helper function (opening a[/color][/color][/color]
        connection[color=blue][color=green]
        > > and[color=darkred]
        > > > returning it):
        > > >
        > > > Function cCon()
        > > > Dim cnRet
        > > > set cnRet = server.createob ject("ADODB.Con nection") 'This is where[/color][/color][/color]
        the[color=blue][color=green][color=darkred]
        > > > error is thrown
        > > > cnRet.connectio nstring = 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[/color][/color]
        > Set[color=green][color=darkred]
        > > > rst = nothing.
        > > >
        > > > I have tested the application on two seperate servers with the same[/color]
        > > result.[color=darkred]
        > > >
        > > > Both machines had more than enough memory.
        > > >
        > > > I have also checked the application log to see if anything was logged,[/color][/color]
        > but[color=green][color=darkred]
        > > > there wasnt.
        > > >
        > > > Any one got ANY ideas on this one? I'm starting to get desperate!
        > > >
        > > >
        > > >
        > > >
        > > >
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Mark Schupp

          #5
          Re: Out of memory: 'Server.CreateO bject'

          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.createob ject("ADODB.Con nection")
          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
          mschupp@ielearn ing.com

          714.637.9480 x17


          "Peter Koller" <peter.koller@s ysteam.no> wrote in message
          news:OkIaLZCUDH A.2036@TK2MSFTN GP10.phx.gbl...[color=blue]
          > 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" <owp777@yahoo.c o.uk> skrev i melding
          > news:bfiod4$e11 $1@codas.jet.uk ...[color=green]
          > > Peter
          > > Looks to me like every time you call cCon() you create an object *cnRet*[/color]
          > but[color=green]
          > > it is never destroyed. In function foo() you create another object[/color][/color]
          *con*[color=blue][color=green]
          > > 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.connectio n object? It is a straightforward action unlike a Win32[/color]
          > API[color=green]
          > > call for example.
          > >
          > > HTH
          > >
          > > Peter
          > >
          > >
          > > "Peter Koller" <peter.koller@s ysteam.no> wrote in message
          > > news:eytYlfBUDH A.2648@TK2MSFTN GP10.phx.gbl...[color=darkred]
          > > > Hi group!
          > > >
          > > > I am getting the following error from my ASP application:
          > > > Microsoft VBScript runtime error '800a0007'
          > > >
          > > > Out of memory: 'Server.CreateO bject'
          > > >
          > > >
          > > >
          > > > It always (as far as i have observed) occurs when i try to create a[/color][/color][/color]
          new[color=blue][color=green][color=darkred]
          > > > ADODB.connectio n object in my cCon helper function (opening a[/color][/color][/color]
          connection[color=blue][color=green]
          > > and[color=darkred]
          > > > returning it):
          > > >
          > > > Function cCon()
          > > > Dim cnRet
          > > > set cnRet = server.createob ject("ADODB.Con nection") 'This is where[/color][/color][/color]
          the[color=blue][color=green][color=darkred]
          > > > error is thrown
          > > > cnRet.connectio nstring = 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[/color][/color]
          > Set[color=green][color=darkred]
          > > > rst = nothing.
          > > >
          > > > I have tested the application on two seperate servers with the same[/color]
          > > result.[color=darkred]
          > > >
          > > > Both machines had more than enough memory.
          > > >
          > > > I have also checked the application log to see if anything was logged,[/color][/color]
          > but[color=green][color=darkred]
          > > > there wasnt.
          > > >
          > > > Any one got ANY ideas on this one? I'm starting to get desperate!
          > > >
          > > >
          > > >
          > > >
          > > >
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          Working...