diff --git a/flow/Profiler.actor.cpp b/flow/Profiler.actor.cpp
index fb6782321a..efcfbbd585 100644
--- a/flow/Profiler.actor.cpp
+++ b/flow/Profiler.actor.cpp
@@ -25,7 +25,6 @@
 #ifdef __linux__
 
 #include <execinfo.h>
-#include <memory>
 #include <signal.h>
 #include <sys/time.h>
 #include <stdlib.h>
@@ -125,7 +124,7 @@ struct Profiler {
 	OutputBuffer* output_buffer;
 	Future<Void> actor;
 	sigset_t profilingSignals;
-	static std::unique_ptr<Profiler> active_profiler;
+	static Profiler* active_profiler;
 	BinaryWriter environmentInfoWriter;
 	INetwork* network;
 	timer_t periodicTimer;
@@ -257,7 +256,8 @@ struct Profiler {
 	}
 };
 
-std::unique_ptr<Profiler> Profiler::active_profiler;
+// Outlives main
+Profiler* Profiler::active_profiler = nullptr;
 
 std::string findAndReplace( std::string const& fn, std::string const& symbol, std::string const& value ) {
 	auto i = fn.find(symbol);
@@ -283,12 +283,14 @@ void startProfiling(INetwork* network, Optional<int> maybePeriod /*= {}*/, Optio
 	outputFile = findAndReplace(findAndReplace(findAndReplace(outputFile, "%ADDRESS%", findAndReplace(network->getLocalAddress().toString(), ":", ".")), "%PID%", format("%d", getpid())), "%TID%", format("%llx", (long long)sys_gettid()));
 
 	if (!Profiler::active_profiler)
-		Profiler::active_profiler = std::make_unique<Profiler>( period, outputFile, network );
+		Profiler::active_profiler = new Profiler( period, outputFile, network );
 }
 
 void stopProfiling() {
 	if (Profiler::active_profiler) {
-		Profiler::active_profiler.reset();
+		Profiler *p = Profiler::active_profiler;
+		Profiler::active_profiler = nullptr;
+		delete p;
 	}
 }