surfaceflinger: free SurfaceTracing memory

Allocate LayersTraceFileProto on the heap because Clear does not
free the memory.  Replace mTrace->Clear() by mTrace.reset().

This is temporary.  Eventually, we want to enable continuous tracing
and dump only the last N frames.  We will record LayersProto in a
circular buffer and create LayersTraceFileProto only to serialize
the buffer to a file.

Bug: 115434782
Test: winscope trace
Change-Id: I3a3e499ace08cd4b06c38be8ad2ad59bfcdba5d7
diff --git a/services/surfaceflinger/SurfaceTracing.h b/services/surfaceflinger/SurfaceTracing.h
index 27e2c9e..fd8cb82 100644
--- a/services/surfaceflinger/SurfaceTracing.h
+++ b/services/surfaceflinger/SurfaceTracing.h
@@ -20,6 +20,7 @@
 #include <utils/Errors.h>
 #include <utils/String8.h>
 
+#include <memory>
 #include <mutex>
 
 using namespace android::surfaceflinger;
@@ -46,7 +47,7 @@
     bool mEnabled = false;
     std::string mOutputFileName = DEFAULT_FILENAME;
     mutable std::mutex mTraceMutex;
-    LayersTraceFileProto mTrace;
+    std::unique_ptr<LayersTraceFileProto> mTrace;
 };
 
 } // namespace android