Results 1 to 3 of 3

Thread: Memory Management

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Jan 2010
    Posts
    132
    Answers
    2
    Vote Rating
    1
      0  

    Default Memory Management

    Are there any good resources on how to manage memory in GXT/GWT?
    I'm not really sure how the garbage collector runs in different browsers and I worry that I could create memory leaks while moving and overwriting lists.

  2. #2
    Sencha User
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Answers
    109
    Vote Rating
    93
      0  

    Default

    JavaScript's memory model is more or less like Java's own memory model - don't reference something, and it will go away when the VM next runs its garbage collection routine. In the browser, you have no control over running gc manually, but that's amount the main difference. As a result, writing GWT/Java as you would normal Java will typically result in the same basic memory patterns - when you remove an object from a list, if it is no longer referenced anywhere else (in another list, from another object, etc), it will be deleted.

    When chasing a memory leak, the easiest way to start is to compile with style=PRETTY, and debug your app in Chrome with the inspector active. Take a heap snapshot, use the app further until it should be in the same state (open/close a window for example), and take another snapshot. You usually will want to repeat this several times, and compare the last several snapshots to see what has been created but not deleted - often the first few times your app is still building new objects as you open windows for the first time.

    The one danger area is when you are building your own container widgets and calling the attach/detach methods manually. This is an area where is it possible to introduce memory leaks in certain browsers. Check out https://developers.google.com/web-to..._leaks_and_you for a quick summary on this topic, and the role of attach/detach methods in this process.

  3. #3
    Sencha User
    Join Date
    Jan 2010
    Posts
    132
    Answers
    2
    Vote Rating
    1
      0  

    Default

    Thank you. I'll try that

Posting Permissions

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