summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2015-12-02 11:40:09 -0800
committerSteve Kondik <steve@cyngn.com>2016-08-19 13:38:25 -0700
commite72652f039b9067f9e747d70184507d41ef1f6d7 (patch)
treecf6b8992962ef5e00b23233e293a3e2327eb3478 /services
parent8d41a10e57903142b9daba6a31a47f101757130c (diff)
downloadframeworks_av-e72652f039b9067f9e747d70184507d41ef1f6d7.zip
frameworks_av-e72652f039b9067f9e747d70184507d41ef1f6d7.tar.gz
frameworks_av-e72652f039b9067f9e747d70184507d41ef1f6d7.tar.bz2
Don't place large objects on the stack
Bug: 25020816 Change-Id: Ife4da9fc3000e645f654f2eb28b37ad3a89d61f9
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/Threads.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index e1e4980..ecdbf43 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -4470,8 +4470,12 @@ void AudioFlinger::MixerThread::dumpInternals(int fd, const Vector<String16>& ar
dprintf(fd, " AudioMixer tracks: 0x%08x\n", mAudioMixer->trackNames());
// Make a non-atomic copy of fast mixer dump state so it won't change underneath us
- const FastMixerDumpState copy(mFastMixerDumpState);
- copy.dump(fd);
+ // while we are dumping it. It may be inconsistent, but it won't mutate!
+ // This is a large object so we place it on the heap.
+ // FIXME 25972958: Need an intelligent copy constructor that does not touch unused pages.
+ const FastMixerDumpState *copy = new FastMixerDumpState(mFastMixerDumpState);
+ copy->dump(fd);
+ delete copy;
#ifdef STATE_QUEUE_DUMP
// Similar for state queue
@@ -6460,9 +6464,13 @@ void AudioFlinger::RecordThread::dumpInternals(int fd, const Vector<String16>& a
dprintf(fd, " Fast capture thread: %s\n", hasFastCapture() ? "yes" : "no");
dprintf(fd, " Fast track available: %s\n", mFastTrackAvail ? "yes" : "no");
- // Make a non-atomic copy of fast capture dump state so it won't change underneath us
- const FastCaptureDumpState copy(mFastCaptureDumpState);
- copy.dump(fd);
+ // Make a non-atomic copy of fast capture dump state so it won't change underneath us
+ // while we are dumping it. It may be inconsistent, but it won't mutate!
+ // This is a large object so we place it on the heap.
+ // FIXME 25972958: Need an intelligent copy constructor that does not touch unused pages.
+ const FastCaptureDumpState *copy = new FastCaptureDumpState(mFastCaptureDumpState);
+ copy->dump(fd);
+ delete copy;
}
void AudioFlinger::RecordThread::dumpTracks(int fd, const Vector<String16>& args __unused)