aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/PathBench.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-06 20:19:14 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-06 20:19:14 +0000
commit8f88117940ebb0a7f514194a4ad3384073c1f145 (patch)
treeca660bf17168796420004a55bb153adaef01a432 /bench/PathBench.cpp
parentda0f7616e99031deb631bce6b7420accffbc2644 (diff)
Cap memory usage in path_create bench.
Memory usage grows unbounded in path_create without this patch (growing the paths). This bench also somewhat needlessly cycles through 32 paths, so now we just work with one. Peak memory usage drops from ~2-3G to ~150M. This should fix the NexusS crashes, or at least get us to the next one. BUG=skia:1687 R=caryclark@google.com Author: mtklein@google.com Review URL: https://codereview.chromium.org/111283007 git-svn-id: http://skia.googlecode.com/svn/trunk@12925 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench/PathBench.cpp')
-rw-r--r--bench/PathBench.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp
index 67bc901c28..e11aad78f0 100644
--- a/bench/PathBench.cpp
+++ b/bench/PathBench.cpp
@@ -327,27 +327,24 @@ protected:
virtual void onPreDraw() SK_OVERRIDE {
this->createData(10, 100);
- fPaths.reset(kPathCnt);
}
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
for (int i = 0; i < loops; ++i) {
- this->makePath(&fPaths[i & (kPathCnt - 1)]);
+ if (i % 1000 == 0) {
+ fPath.reset(); // PathRef memory can grow without bound otherwise.
+ }
+ this->makePath(&fPath);
}
this->restartMakingPaths();
}
virtual void onPostDraw() SK_OVERRIDE {
this->finishedMakingPaths();
- fPaths.reset(0);
}
private:
- enum {
- // must be a pow 2
- kPathCnt = 1 << 5,
- };
- SkAutoTArray<SkPath> fPaths;
+ SkPath fPath;
typedef RandomPathBench INHERITED;
};