IIS4 application variable removal

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nutso fasst

    IIS4 application variable removal

    Hi. Any way to do this from asp page in IIS4? Application.Con tents.Remove is
    IIS 5+. Setting variable to empty string does not remove variable.

    thx,
    nf


  • Slim

    #2
    Re: IIS4 application variable removal

    try something like this

    for each val in Application.con tents
    Application(val ) = null
    next


    "nutso fasst" <no.replies@no. wherewrote in message
    news:e7f7F5U9GH A.1808@TK2MSFTN GP03.phx.gbl...
    Hi. Any way to do this from asp page in IIS4? Application.Con tents.Remove
    is
    IIS 5+. Setting variable to empty string does not remove variable.
    >
    thx,
    nf
    >
    >

    Comment

    • Bob Barrows [MVP]

      #3
      Re: IIS4 application variable removal

      nutso fasst wrote:
      Hi. Any way to do this from asp page in IIS4?
      Application.Con tents.Remove is IIS 5+. Setting variable to empty
      string does not remove variable.
      >
      I suspect Set Application("va r") = Nothing will suit your purpose.

      --
      Microsoft MVP - ASP/ASP.NET
      Please reply to the newsgroup. This email account is my spam trap so I
      don't check it very often. If you must reply off-line, then remove the
      "NO SPAM"


      Comment

      • nutso fasst

        #4
        Re: IIS4 application variable removal


        "Bob Barrows [MVP]" <reb01501@NOyah oo.SPAMcomwrote in message
        news:#Zfjpuc9GH A.3384@TK2MSFTN GP05.phx.gbl...
        I suspect Set Application("va r") = Nothing will suit your purpose.
        No, that produces an error. And this:
        Set Application("va r") = Nothing
        creates an empty object. The variable is not removed.

        Guess I'll just have to work with arrays stored in variables declared in
        global.asa. No remove function was dumb!

        thx 4 reply,
        nf


        Comment

        • nutso fasst

          #5
          Re: IIS4 application variable removal


          "Slim" <me@here.comwro te in message
          news:eYIAphY9GH A.3264@TK2MSFTN GP04.phx.gbl...
          try something like this
          >
          for each val in Application.con tents
          Application(val ) = null
          next
          Nope, setting the variables to null doesn't remove the variables.

          thx,
          nf


          Comment

          • Bob Barrows [MVP]

            #6
            Re: IIS4 application variable removal

            nutso fasst wrote:
            "Bob Barrows [MVP]" <reb01501@NOyah oo.SPAMcomwrote in message
            news:#Zfjpuc9GH A.3384@TK2MSFTN GP05.phx.gbl...
            >I suspect Set Application("va r") = Nothing will suit your purpose.
            >
            No, that produces an error. And this:
            Set Application("va r") = Nothing
            How is this any different from what I wrote?
            creates an empty object.
            or dereferences an existing one.
            The variable is not removed.
            >
            Guess I'll just have to work with arrays stored in variables declared
            in global.asa. No remove function was dumb!
            >
            I don't understand the requirement to "remove" the variable. If your
            goal is simply to reclaim memory space, then setting the variable to
            nothing should do that.

            --
            Microsoft MVP -- ASP/ASP.NET
            Please reply to the newsgroup. The email account listed in my From
            header is my spam trap, so I don't check it very often. You will get a
            quicker response by posting to the newsgroup.


            Comment

            • nutso fasst

              #7
              Re: IIS4 application variable removal


              "Bob Barrows [MVP]" <reb01501@NOyah oo.SPAMcomwrote in message
              news:OdEik9u9GH A.4712@TK2MSFTN GP03.phx.gbl...
              No, that produces an error. And this:
              Set Application("va r") = Nothing
              >
              How is this any different from what I wrote?
              I see now it's not (said the blind carpenter, as he picked up his hammer and
              saw).
              creates an empty object.
              >
              or dereferences an existing one.
              In this case it changed an existing item into an object reference.
              I don't understand the requirement to "remove" the variable. If your
              goal is simply to reclaim memory space, then setting the variable to
              nothing should do that.
              That doesn't quite happen. Using this code to show variables:

              For Each Item in Application.Con tents
              If IsObject(Applic ation.Contents( Item)) Then
              Response.Write Item & " is an object.<br>"
              ElseIf IsArray(Applica tion.Contents(I tem)) Then
              Response.Write Item & " is an array.<br>"
              Else
              Response.Write Item & "=" & Application.Con tents(Item) & "<br>"
              End If
              Next

              Whether I assign it a null value or an empty string, or set it to Nothing
              (in which case the above code reports it has become an object), the variable
              is still there. If the variable exists then there is still memory being used
              for the variable. So dynamically creating application variables with names
              based on visitor IP addresses, for example, will constitute a virtual memory
              leak as the Application.Con tents collection grows and grows.

              nf


              Comment

              • Bob Barrows [MVP]

                #8
                Re: IIS4 application variable removal

                nutso fasst wrote:
                "Bob Barrows [MVP]" <reb01501@NOyah oo.SPAMcomwrote in message
                news:OdEik9u9GH A.4712@TK2MSFTN GP03.phx.gbl...
                >> Set Application("va r") = Nothing
                >>creates an empty object.
                >>
                >or dereferences an existing one.
                >
                In this case it changed an existing item into an object reference.
                Why is that relevant? The memory occupied by a reference to Nothing should
                be negligable. It should certainly be less than the memory previously
                occupied by that variable.
                >
                >I don't understand the requirement to "remove" the variable. If your
                >goal is simply to reclaim memory space, then setting the variable to
                >nothing should do that.
                >
                <snip>
                >
                Whether I assign it a null value or an empty string, or set it to
                Nothing (in which case the above code reports it has become an
                object), the variable is still there. If the variable exists then
                there is still memory being used for the variable. So dynamically
                creating application variables with names based on visitor IP
                addresses, for example, will constitute a virtual memory leak as the
                Application.Con tents collection grows and grows.
                >
                Ah. OK. Have you tested the effect of such a "leak" on your appliction? If
                so, and your testing indicates that it will cause a problem, then yes, you
                will need to use some sort of array- or xml document-based solution (if the
                latter, make sure you use the free-threaded version, or simply store the xml
                string)

                You should be aware that arrays have their own "issues", i.e., the inability
                to remove elements except from the end of the array. Javascript arrays are
                superior to vbscript arrays in this respect. Also, since you will need to
                lock and unlock application when updating this variable, you will cause it
                to be serialized, impacting your application's performance.

                --
                Microsoft MVP - ASP/ASP.NET
                Please reply to the newsgroup. This email account is my spam trap so I
                don't check it very often. If you must reply off-line, then remove the
                "NO SPAM"


                Comment

                • nutso fasst

                  #9
                  Re: IIS4 application variable removal


                  "Bob Barrows [MVP]" <reb01501@NOyah oo.SPAMcomwrote in message
                  news:OMdPF509GH A.2300@TK2MSFTN GP04.phx.gbl...
                  You should be aware that arrays have their own "issues", i.e., the
                  inability
                  to remove elements except from the end of the array. Javascript arrays are
                  superior to vbscript arrays in this respect. Also, since you will need to
                  Yeah, slice is nice. In this case the only messing with the middle of an
                  array is to remove matching items, which I'm doing thusly:

                  myarray = Split(Replace(R eplace(Replace( Join(myarray),r emitem & " ","")," "
                  & remitem,""),rem item,"")
                  lock and unlock application when updating this variable, you will cause it
                  to be serialized, impacting your application's performance.
                  Yep. Just have to see how it goes.

                  Anyway, the no-remove limitation was actually a good thing as it works
                  better keeping the dynamic variables on the client.

                  thx,
                  nf



                  Comment

                  • Slim

                    #10
                    Re: IIS4 application variable removal


                    "nutso fasst" <no.replies@no. wherewrote in message
                    news:eqT610u9GH A.2316@TK2MSFTN GP04.phx.gbl...
                    >
                    "Slim" <me@here.comwro te in message
                    news:eYIAphY9GH A.3264@TK2MSFTN GP04.phx.gbl...
                    >try something like this
                    >>
                    >for each val in Application.con tents
                    >Application(va l) = null
                    >next
                    >
                    Nope, setting the variables to null doesn't remove the variables.
                    Sorry i misread your post


                    >
                    thx,
                    nf
                    >
                    >

                    Comment

                    • upmendez

                      #11
                      RE: IIS4 application variable removal

                      Make sure to leave out parenthesis:
                      Application.Con tents.Remove "something"

                      Comment

                      Working...