Results 1 to 2 of 2
  1. diomark's Avatar
    Posts
    752 Posts
    Global Posts
    770 Global Posts
       #1  
    I've been analyzing WebOS 1.3.1 this morning looking for memory leaks.. did find one which is annoying..

    If you use the browser, it now stores files in the disk cache (which is really in /tmp) - specifically in /tmp/webimagecache and /tmp/webdiskcache

    The browser-app.conf file specifies that the cache should grow to no more then 8mb's.. but in my experience it's ignoring this limit. in testing, I had the browser cache get up to 30mb's and not go down upon closing the browser. Files in /tmp come out of memory (which can get swapped..) - it counts against your 'cached' quote in memory.. i.e. 30mb's of disk cache for websites that I visited earlier today = 30mb's less for apps..

    My javascript skills are lacking, but I would love to see an option to automatically clear the cache upon exit. The cache can be manually cleared (by going to the browser's options), so I know it should be possible to automate this.

    Code:
    /usr/palm/applications/com.palm.app.browser/resources/es_us/views/preferences/preferences-scene.html:    <div class="palm-button" id="clear_cache_button" x-mojo-tap-highlight="momentary">Borrar memoria caché</div>
    /usr/palm/applications/com.palm.app.browser/resources/es_us/strings.json:       "Clear cache": "Borrar memoria caché",
    /usr/palm/applications/com.palm.app.browser/resources/es_us/strings.json:       "Clear your browser cache?": "¿Quieres borrar la memoria caché de tu navegador?",
    root@palm-webos-device:/# /usr/palm/applications/com.palm.app.browser/app/views/preferences/preferences-scene.html:    <div class="palm-button" id="clear_cache_button" x-mojo-tap-highlight="momentary" x-mojo-loc=''>Clear Cache</div>
    /usr/palm/applications/com.palm.app.browser/app/controllers/app-assistant.jsjsjs:           '$ClearCache$': $false$,
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$app$-$assistant$.$js$:                           $if$ ($actor$.$clearCache$ &$amp$;&$amp$; $this$.$ClearCache$) {
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$app$-$assistant$.$js$:                                   //$Mojo$.$Log$.$info$(&$quot$;@@@ $WEB$ $PREFS$: $Clearing$ $Cache$&$quot$;);
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$app$-$assistant$.$js$:                                   $actor$.$clearCache$();
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$app$-$assistant$.$js$:                                   $this$.$ClearCache$ = $false$;
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$customizeicon$-$assistant$.$js$: $var$ $params$ = { $cacheAdapter$: $false$ };   // $Caching$ $uses$ $too$ $much$ $memory$.
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$widget_webview$.$js$:      $cacheAdapter$        $Boolean$     $Optional$    $undefined$   $If$ $true$, $cache$ $this$ $adapter$, $false$ $if$ $not$, $or$ $undefined$ $to$ $not$ $specify$ $and$ $use$ $the$
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$widget_webview$.$js$:                          $if$ ($this$.$controller$.$attributes$.$cacheAdapter$ !== $undefined$) {
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$widget_webview$.$js$:                                  $this$.$adapter$.$setAttribute$(&$quot$;$x$-$palm$-$cache$-$plugin$&$quot$;, $this$.$controller$.$attributes$.$cacheAdapter$ ? '$true$' : '$false$');
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$widget_webview$.$js$:                                          &$quot$;$clearCache$&$quot$;, &$quot$;$clearCookies$&$quot$;, &$quot$;$deleteImage$&$quot$;, &$quot$;$generateIconFromFile$&$quot$;,
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$widget_webview$.$js$:  $clearCache$: $function$() {
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$widget_webview$.$js$:                  $this$.$adapter$.$clearCache$();
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$page$-$assistant$.$js$:          // $Clear$ $any$ $cached$ $URLs$
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$page$-$assistant$.$js$:          // $any$ $cached$ $URLs$.
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$preferences$-$assistant$.$js$:   $this$.$_clearCacheHandler$ = $this$.$clearCache$.$bindAsEventListener$($this$);
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$preferences$-$assistant$.$js$:   $this$.$controller$.$listen$('$clear_cache_button$', $Mojo$.$Event$.$tap$, $this$.$_clearCacheHandler$);
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$preferences$-$assistant$.$js$:   $this$.$controller$.$stopListening$('$clear_cache_button$', $Mojo$.$Event$.$tap$, $this$.$_clearCacheHandler$);
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$preferences$-$assistant$.$js$:$PreferencesAssistant$.$prototype$.$clearCache$ = $function$($event$) {
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$preferences$-$assistant$.$js$:                                   $this$.$_webPreferences$.$ClearCache$ = $true$;
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$preferences$-$assistant$.$js$:                           $Mojo$.$Log$.$logException$($e$, &$quot$;$clearing$ $cache$&$quot$;);
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$preferences$-$assistant$.$js$:           $title$:$$L$('$Clear$ $cache$'),
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$preferences$-$assistant$.$js$:           $message$:$$L$('$Clear$ $your$ $browser$ $cache$?'),
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$controllers$/$preferences$-$assistant$.$js$:           {$label$:$$L$('$Clear$ $cache$'), $value$:'$ok$', $type$:'$color$'},
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$models$/$browser$-$prefs$.$js$:        $this$.$ClearCache$ = $false$;
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$models$/$browser$-$prefs$-$store$.$js$:          $if$ ($prefs$.$ClearCache$ !== $undefined$) {
    /$usr$/$palm$/$applications$/$com$.$palm$.$app$.$browser$/$app$/$models$/$browser$-$prefs$-$store$.$js$:                  $this$.$prefs$.$ClearCache$ = $prefs$.$ClearCache$;
    Anyone want to take a stab at it?

    This is creating a memory leak in webos 1.3.1 which isn't getting cleared upon reboot. (there might be a low-memory threashold as well in the BrowserServer process which automatically cleans this, but I hadn't seen it.. )

    -mark
  2. diomark's Avatar
    Posts
    752 Posts
    Global Posts
    770 Global Posts
       #2  
    Actually, I think I found a cleaner way - modifying /etc/event.d/browserserver to delete that directory first.. still researching, will report back. -m

Posting Permissions