summaryrefslogtreecommitdiffstats
path: root/src/disk_interface.h
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2014-06-15 21:11:27 (GMT)
committerNico Weber <thakis@chromium.org>2014-06-15 21:13:54 (GMT)
commit726afc8226a10cd6c5ce724a845ff5cd17169091 (patch)
tree2c19ad79d9356ea6e63ba710fa8d92d532f0c491 /src/disk_interface.h
parent9970174e2ab8e4d5c9f333b795c8d284cf1cb8f5 (diff)
downloadNinja-726afc8226a10cd6c5ce724a845ff5cd17169091.zip
Ninja-726afc8226a10cd6c5ce724a845ff5cd17169091.tar.gz
Ninja-726afc8226a10cd6c5ce724a845ff5cd17169091.tar.bz2
Free cache memory once it's no longer used.
Doesn't slow down empty build times measurably, and saves some memory on non-empty builds.
Diffstat (limited to 'src/disk_interface.h')
-rw-r--r--src/disk_interface.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/disk_interface.h b/src/disk_interface.h
index bb40dc9..40c24b6 100644
--- a/src/disk_interface.h
+++ b/src/disk_interface.h
@@ -61,7 +61,7 @@ struct RealDiskInterface : public DiskInterface {
, use_cache_(false)
#endif
{}
- virtual ~RealDiskInterface() {}
+ virtual ~RealDiskInterface() { ClearCache(); }
virtual TimeStamp Stat(const string& path);
virtual bool MakeDir(const string& path);
virtual bool WriteFile(const string& path, const string& contents);
@@ -70,6 +70,9 @@ struct RealDiskInterface : public DiskInterface {
/// Whether to print on errors. Used to make a test quieter.
bool quiet_;
+
+ /// Whether stat information can be cached.
+ void AllowCache(bool allow);
#ifdef _WIN32
/// Whether stat information can be cached.
bool use_cache_;
@@ -80,6 +83,7 @@ struct RealDiskInterface : public DiskInterface {
typedef map<string, DirCache*> Cache;
Cache cache_;
#endif
+ void ClearCache();
};
#endif // NINJA_DISK_INTERFACE_H_