Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Is Memory Leak happening here.

Is Memory Leak happening here.

Scheduled Pinned Locked Moved ASP.NET
questionsysadmindata-structuresperformanceannouncement
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vjvjvjvj
    wrote on last edited by
    #1

    Hi all, In my project, Parent page opens a child page using window.open method on a button click. Child page has a method LoadDropDownList() in page_load, which is supposed to populate a drop down list in the page. LoadDropDownList method creates an object of a class from the referenced library and calls a method on that object which performs some heavy operation to get strings and populate the dropdownlist. This takes around 3-4 seconds. I release the object in the finally{} block in this method. Now, Even if my child page is closed using (X button) immediately after its opened (before 3 seconds), the loaddropdownlist method is already initiated. After that I open the child and close it immediately for 3-4 times aproximately and then the next time parent page is unable to open child page . IE 7 just shows running status. Probably Server experiences some heavy load due to multiple LoadDropDownList ongoing runs in the stack. Is memory leak is happening here? Shouldn't it stop running child's LoadDropDownList() and get read of the objects immediately after I close the form? But it's not happening. I found control returns to this method multiple times after i (opened for number of times and) closed the form respectively. What is the remedy here? How child should stop running any method in it after it's closed? Kind regards, Vijay

    T V A 3 Replies Last reply
    0
    • V vjvjvjvj

      Hi all, In my project, Parent page opens a child page using window.open method on a button click. Child page has a method LoadDropDownList() in page_load, which is supposed to populate a drop down list in the page. LoadDropDownList method creates an object of a class from the referenced library and calls a method on that object which performs some heavy operation to get strings and populate the dropdownlist. This takes around 3-4 seconds. I release the object in the finally{} block in this method. Now, Even if my child page is closed using (X button) immediately after its opened (before 3 seconds), the loaddropdownlist method is already initiated. After that I open the child and close it immediately for 3-4 times aproximately and then the next time parent page is unable to open child page . IE 7 just shows running status. Probably Server experiences some heavy load due to multiple LoadDropDownList ongoing runs in the stack. Is memory leak is happening here? Shouldn't it stop running child's LoadDropDownList() and get read of the objects immediately after I close the form? But it's not happening. I found control returns to this method multiple times after i (opened for number of times and) closed the form respectively. What is the remedy here? How child should stop running any method in it after it's closed? Kind regards, Vijay

      T Offline
      T Offline
      T M Gray
      wrote on last edited by
      #2

      Closing the browser does not tell the server anything. So the server still does all the processing initiated by the request as if nothing happened. It is not a memory leak from the browser point of view. But if only 3-4 calls to this process of yours are enough to slow down the server you really need to evaluate that method and figure out how to optimize it.

      1 Reply Last reply
      0
      • V vjvjvjvj

        Hi all, In my project, Parent page opens a child page using window.open method on a button click. Child page has a method LoadDropDownList() in page_load, which is supposed to populate a drop down list in the page. LoadDropDownList method creates an object of a class from the referenced library and calls a method on that object which performs some heavy operation to get strings and populate the dropdownlist. This takes around 3-4 seconds. I release the object in the finally{} block in this method. Now, Even if my child page is closed using (X button) immediately after its opened (before 3 seconds), the loaddropdownlist method is already initiated. After that I open the child and close it immediately for 3-4 times aproximately and then the next time parent page is unable to open child page . IE 7 just shows running status. Probably Server experiences some heavy load due to multiple LoadDropDownList ongoing runs in the stack. Is memory leak is happening here? Shouldn't it stop running child's LoadDropDownList() and get read of the objects immediately after I close the form? But it's not happening. I found control returns to this method multiple times after i (opened for number of times and) closed the form respectively. What is the remedy here? How child should stop running any method in it after it's closed? Kind regards, Vijay

        V Offline
        V Offline
        Vimalsoft Pty Ltd
        wrote on last edited by
        #3

        Vijay you say that you have a function that Binds the DropdownList. i have few questions for you. How many times does this function call appear in your code ? Do you Protect that Function against unnecessary post backs by doing something like

        if(!Page.Ispostback)
        {

        }

        The Slowness of your page might be caused by a lot of things , please give us more info and tell us what you are doing or share a part that binds the dropdown

        Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

        1 Reply Last reply
        0
        • V vjvjvjvj

          Hi all, In my project, Parent page opens a child page using window.open method on a button click. Child page has a method LoadDropDownList() in page_load, which is supposed to populate a drop down list in the page. LoadDropDownList method creates an object of a class from the referenced library and calls a method on that object which performs some heavy operation to get strings and populate the dropdownlist. This takes around 3-4 seconds. I release the object in the finally{} block in this method. Now, Even if my child page is closed using (X button) immediately after its opened (before 3 seconds), the loaddropdownlist method is already initiated. After that I open the child and close it immediately for 3-4 times aproximately and then the next time parent page is unable to open child page . IE 7 just shows running status. Probably Server experiences some heavy load due to multiple LoadDropDownList ongoing runs in the stack. Is memory leak is happening here? Shouldn't it stop running child's LoadDropDownList() and get read of the objects immediately after I close the form? But it's not happening. I found control returns to this method multiple times after i (opened for number of times and) closed the form respectively. What is the remedy here? How child should stop running any method in it after it's closed? Kind regards, Vijay

          A Offline
          A Offline
          Abhishek Sur
          wrote on last edited by
          #4

          This is a major issue which you cant do anything. Actually ASP.NET runs in request response approach. so whenever you call the server to get the dropdownlist, you are actually creating a new thread to send your request object from your browser. Now after receiving the request object to the browser, until it sends back the response, you dont have any communication between the client and the server. At that moment, the browser shows something like "Waiting for Response... ". If you close your browser the processing will not stop and hence your server will keep doing processing. I think one option might be useful in this regard. You might cache the result for few seconds, so that the same request when received within a minute, it will be served from cache, rather than go and process it again. This would improve the performance of the page (only if the data is not very big) I hope Caching would be the best solution for your problem, as there is no straightforward way to stop the thread running in the server before sending the response. :thumbsup:

          Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


          Visit My Website-->**

          www.abhisheksur.com

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups