Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: Source/wtf/Partitions.cpp

Issue 1155293007: Expose ReleaseFreeMemory to free up memory on memory pressure or idle cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: made changes. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 { 65 {
66 // We could ASSERT here for a memory leak within the partition, but it leads 66 // We could ASSERT here for a memory leak within the partition, but it leads
67 // to very hard to diagnose ASSERTs, so it's best to leave leak checking for 67 // to very hard to diagnose ASSERTs, so it's best to leave leak checking for
68 // the valgrind and heapcheck bots, which run without partitions. 68 // the valgrind and heapcheck bots, which run without partitions.
69 (void) m_renderingAllocator.shutdown(); 69 (void) m_renderingAllocator.shutdown();
70 (void) m_objectModelAllocator.shutdown(); 70 (void) m_objectModelAllocator.shutdown();
71 (void) m_bufferAllocator.shutdown(); 71 (void) m_bufferAllocator.shutdown();
72 (void) m_fastMallocAllocator.shutdown(); 72 (void) m_fastMallocAllocator.shutdown();
73 } 73 }
74 74
75 void Partitions::releaseFreeMemory()
76 {
77 ASSERT(isMainThread());
78
79 spinLockLock(&getBufferPartition()->lock);
haraken 2015/06/03 11:39:00 Can we move this lock into partitionPurgeMemory?
ssid 2015/06/03 11:45:31 1. PartitionRootBase is a struct and partitionPurg
80 partitionPurgeMemory(getBufferPartition());
81 spinLockUnlock(&getBufferPartition()->lock);
82
83 spinLockLock(&getFastMallocPartition()->lock);
84 partitionPurgeMemory(getFastMallocPartition());
85 spinLockUnlock(&getFastMallocPartition()->lock);
86
87 partitionPurgeMemory(getObjectModelPartition());
88 partitionPurgeMemory(getRenderingPartition());
89 }
90
75 void Partitions::reportMemoryUsageHistogram() 91 void Partitions::reportMemoryUsageHistogram()
76 { 92 {
77 static size_t supportedMaxSizeInMB = 4 * 1024; 93 static size_t supportedMaxSizeInMB = 4 * 1024;
78 static size_t observedMaxSizeInMB = 0; 94 static size_t observedMaxSizeInMB = 0;
79 95
80 if (!m_histogramEnumeration) 96 if (!m_histogramEnumeration)
81 return; 97 return;
82 // We only report the memory in the main thread. 98 // We only report the memory in the main thread.
83 if (!isMainThread()) 99 if (!isMainThread())
84 return; 100 return;
(...skipping 15 matching lines...) Expand all
100 // accessed only on the main thread. 116 // accessed only on the main thread.
101 ASSERT(isMainThread()); 117 ASSERT(isMainThread());
102 118
103 partitionDumpStatsGeneric(getFastMallocPartition(), "fast_malloc_partition", partitionStatsDumper); 119 partitionDumpStatsGeneric(getFastMallocPartition(), "fast_malloc_partition", partitionStatsDumper);
104 partitionDumpStatsGeneric(getBufferPartition(), "buffer_partition", partitio nStatsDumper); 120 partitionDumpStatsGeneric(getBufferPartition(), "buffer_partition", partitio nStatsDumper);
105 partitionDumpStats(getObjectModelPartition(), "object_model_partition", part itionStatsDumper); 121 partitionDumpStats(getObjectModelPartition(), "object_model_partition", part itionStatsDumper);
106 partitionDumpStats(getRenderingPartition(), "rendering_partition", partition StatsDumper); 122 partitionDumpStats(getRenderingPartition(), "rendering_partition", partition StatsDumper);
107 } 123 }
108 124
109 } // namespace WTF 125 } // namespace WTF
OLDNEW
« no previous file with comments | « Source/wtf/Partitions.h ('k') | public/web/WebKit.h » ('j') | public/web/WebKit.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698