Results 1 to 19 of 19

Thread: Memory Leak problem, how to clear memory?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    395

    Memory Leak problem, how to clear memory?

    Does anyone have code to clear memory?

    My program dies after a while of usage, i need to clear the memory after each process.... hrm...

  2. #2
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Re: Memory Leak problem, how to clear memory?

    Well ways to reduce memory usage first off would be using
    Code:
    VbNullString
    instead of
    Code:
    = ""
    That is only when it is possible to use either.

    I am not to certain as to how to clear the ram, exactly. But apparently there are some programs that use up as much ram as possible then clear it. There might possibly be an open source example some where my friend made one but he made a while back and doesn't have the source no more.
    Last edited by Paul M; May 2nd, 2007 at 01:56 AM. Reason: mis reasoning

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    395

    Re: Memory Leak problem, how to clear memory?

    is there any way to restart a control without restarting the entire program? Like, restart webbrowser1 for example? Without killing the exe?
    8 gigs/ram (hey why not)
    300 gig HD x2
    Windows XP 64

  4. #4
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Re: Memory Leak problem, how to clear memory?

    I forget the exact functioning behind the refresh command but that should work. Example
    Code:
    Text1.Refresh
    MSDN will tell you more

  5. #5
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Re: Memory Leak problem, how to clear memory?

    It should just basically reload the UI(User Interface).
    I wonder if instead of doing the following for every control
    Code:
    controlname.Refresh
    If doing just...
    Code:
    Me.Refresh
    will do the same thing? I believe it should
    Last edited by Paul M; May 2nd, 2007 at 02:02 AM. Reason: mistype

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    395

    Re: Memory Leak problem, how to clear memory?

    Is there any way to restart a control without restarting the entire program? Like, restart webbrowser1 for example? Without killing the exe?
    8 gigs/ram (hey why not)
    300 gig HD x2
    Windows XP 64

  7. #7
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Re: Memory Leak problem, how to clear memory?

    Sorry for misleading you. But when i say reload i mean refresh but it doesn't close. Everything stays the same it just 'refreshes' it self

  8. #8
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Memory Leak problem, how to clear memory?

    We would have to see your code otherwise we will just make general suggestion like set your controls = nothing after usage. Most likely you create new objects and do not release them then create new objects.

    Could be a number of things though...

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    395

    Re: Memory Leak problem, how to clear memory?

    If possible I would like a way to "reset" or "restart" the webbrowser control....
    8 gigs/ram (hey why not)
    300 gig HD x2
    Windows XP 64

  10. #10
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Memory Leak problem, how to clear memory?

    You will need to post your project or code to say the least...

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    395

    Re: Memory Leak problem, how to clear memory?

    Anyone else?
    8 gigs/ram (hey why not)
    300 gig HD x2
    Windows XP 64

  12. #12
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Memory Leak problem, how to clear memory?

    Well, you could at least post some of your codes so that we can pinpoint the problem.

    I can give you tips but this will not help much to the actual problems you're encountering.

    Some tips i know...

    Set it to New when instantiating objects. Instead of doing this

    Code:
    Dim aVariable As New Class.Description
    do it like this

    Code:
    Dim aVariable As Class.Description
    
    'will create a new instance
    Set aVariable = New Class.Description
    
    'Remove from memory
    Set aVariable = Nothing
    The general idea is to make sure all processes are properly disposed or terminated before exiting the program. Setting objects to nothing, unloading, etc etc.

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    395

    Re: Memory Leak problem, how to clear memory?

    It's webbrowser control.

    All events are triggered by the documentcomplete function. It loops...

    That's why it takes a lot of memory.

    The problem lies with webbrowser1...
    8 gigs/ram (hey why not)
    300 gig HD x2
    Windows XP 64

  14. #14

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    395

    Re: Memory Leak problem, how to clear memory?

    I would just like to clear the memory in general, is there any sample code around here?

  15. #15
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Memory Leak problem, how to clear memory?

    You really don't understand how this works...

  16. #16
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068

    Re: Memory Leak problem, how to clear memory?

    In Task Manager is your program using insane amounts of memory or what? Does it go up over time or stay the same?

  17. #17
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Memory Leak problem, how to clear memory?

    @erbio

    You can't do anything about it. If you want to control the amount of memory usage then you create your own webbrowser and never rely on Iexplorer component control. Search on how to parse html if you have the guts to go nuts.

  18. #18
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Memory Leak problem, how to clear memory?

    Without seeing your code this is non-productive...

  19. #19
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: Memory Leak problem, how to clear memory?

    He might be refering to the stack... if so erbio then you'll have to come up with another scheme (such as a queue?) for your procedure calls to keep them from exhausting the stack.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width