I am currently working on a local JS based web application running on the
Webkit engine. To save some memory I forcibly called the evict function in
MemoryCache.cpp and called that from an API and used it to remove the local
WebUI files (Images, CSS and JS) just when the page finished loading.

On enabling dumpStats in MemoryCache.cpp and calling it from the evict
function, I saw that I saved near about 5MB of space. However, this did not
reflect in the rss data of the current process (cat proc/xxx/rss).

Before I wrote any code,
RSS data showed about 57MB for Google which decreased to 54-55MB.

dumpStats data after the final evict call -

                  Count        Size            LiveSize
DecodedSize                PurgeableSize               PurgedSize
-------------    -------------   -------------       -------------
       -------------                       -------------
  -------------
Images          151        6370440        6370440                 5284580
                        0                                 0
CSS               30           365111          365111
   0                            0                                 0
JavaScript       79          2369820         2369820                208120
                          0                                 0
Fonts                0                0                   0
           0                             0                                 0
-------------     -------------    -------------      -------------
       -------------                      -------------
-------------





After I entered my code,
RSS data consistently showed 57-58MB for Google.

dumpStats data after final evict call -

                        Count            Size             LiveSize
 DecodedSize       PurgeableSize       PurgedSize
-------------           -------------    -------------
 -------------             -------------            -------------
  -------------
Images                  9           2960290          2960290
 2883668                   0                       0
CSS                      0                  0                    0
                    0                   0                       0
JavaScript             3              469114            469114
    97192                  0                       0
Fonts                     0                  0                   0
                    0                    0                       0
-------------           -------------       -------------
 -------------                -------------         -------------
   -------------

Why is there such a discrepancy between the dumpStats and RSS logs?
Why are the dumpStats results not getting reflected in the rss?

Is there something I am missing?

Code ---

void MemoryCache::call_evict()
{
int size = memoryCache()->GetCacheResources().size();
for (int i = 0; i < size; i++) {
CachedResource* current = memoryCache()->GetCacheResources()[i].m_tail;
while(current){
CachedResource* prev = current->m_prevInAllResourcesList;
printf("\nD2************Inside call_evict i: %d size:%d \n", i, size);
if(!strncmp("file://",current->url().string().latin1().data(), 7))
{
printf("\nD2************* delete Evict called upon URL: %s\n",
current->url().string().latin1().data());
memoryCache()->evict(current);
}
current = prev;
}
}

}

Thanks for the help in advance.
_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to