Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 97af2039 authored by Yanqiang Fan's avatar Yanqiang Fan Committed by Denis Hsu
Browse files

Mediaserver memory increase after record

mediaserver pss memory in meminfo cat by 'adb shell dumpsys meminfo mediaserver'
will increase after memory leak test. The test will record many times using front
and back camera.
we found mediametrics::Item been create but not been deleted when do video record,
witch will cause memory leak. We should always delete it if mMetricsItem not NULL.

Bug: 174438149
Change-Id: I45e5a7918f032058fd76023c2ca4d82881e8f9d1
parent 0a1a5043
Loading
Loading
Loading
Loading
+7 −4
Original line number Original line Diff line number Diff line
@@ -125,6 +125,7 @@ StagefrightRecorder::StagefrightRecorder(const String16 &opPackageName)


    ALOGV("Constructor");
    ALOGV("Constructor");


    mMetricsItem = NULL;
    mAnalyticsDirty = false;
    mAnalyticsDirty = false;
    reset();
    reset();
}
}
@@ -199,11 +200,13 @@ void StagefrightRecorder::updateMetrics() {
void StagefrightRecorder::flushAndResetMetrics(bool reinitialize) {
void StagefrightRecorder::flushAndResetMetrics(bool reinitialize) {
    ALOGV("flushAndResetMetrics");
    ALOGV("flushAndResetMetrics");
    // flush anything we have, maybe setup a new record
    // flush anything we have, maybe setup a new record
    if (mAnalyticsDirty && mMetricsItem != NULL) {
    if (mMetricsItem != NULL) {
        if (mAnalyticsDirty) {
            updateMetrics();
            updateMetrics();
            if (mMetricsItem->count() > 0) {
            if (mMetricsItem->count() > 0) {
                mMetricsItem->selfrecord();
                mMetricsItem->selfrecord();
            }
            }
        }
        delete mMetricsItem;
        delete mMetricsItem;
        mMetricsItem = NULL;
        mMetricsItem = NULL;
    }
    }