Fix bug 105344 "Memory cache should be based on amount of physical RAM"

This allows the cache to use a lot more memory than previously.
r=saari, sr=darin.


git-svn-id: svn://10.0.0.236/trunk@141677 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
gordon%netscape.com
2003-04-23 05:15:48 +00:00
parent 14d722e427
commit e07a0ba8a9
3 changed files with 242 additions and 116 deletions

View File

@@ -30,6 +30,7 @@
#include "nsICacheVisitor.h"
#include "nsCRT.h"
#include "nsCache.h"
#include "nsReadableUtils.h"
// The memory cache implements a variation of the "LRU-SP" caching algorithm
// described in "LRU-SP: A Size-Adjusted and Popularity-Aware LRU Replacement
@@ -519,7 +520,15 @@ NS_IMETHODIMP
nsMemoryCacheDeviceInfo::GetUsageReport(char ** result)
{
NS_ENSURE_ARG_POINTER(result);
*result = nsCRT::strdup("Memory cache usage report:");
nsCString buffer;
buffer.Assign("<table>\n");
buffer.Append("<tr><td><b>Inactive Storage:</b></td><td><tt> ");
buffer.AppendInt(mDevice->mInactiveSize / 1024);
buffer.Append(" k</tt></td></tr>\n");
buffer.Append("</table>\n");
*result = ToNewCString(buffer);
if (!*result) return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}