diff --git a/src/flag-definitions.h b/src/flag-definitions.h index 4962cf2f45..5d0e981ab4 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -917,6 +917,8 @@ DEFINE_BOOL(heap_profiler_trace_objects, false, "Dump heap object allocations/movements/size_updates") DEFINE_BOOL(heap_profiler_use_embedder_graph, true, "Use the new EmbedderGraph API to get embedder nodes") +DEFINE_INT(heap_snapshot_string_limit, 1024, + "truncate strings to this length in the heap snapshot") // sampling-heap-profiler.cc DEFINE_BOOL(sampling_heap_profiler_suppress_randomness, false, diff --git a/src/profiler/strings-storage.cc b/src/profiler/strings-storage.cc index 2e8ad779fd..9ea7770b4b 100644 --- a/src/profiler/strings-storage.cc +++ b/src/profiler/strings-storage.cc @@ -80,7 +80,7 @@ const char* StringsStorage::GetVFormatted(const char* format, va_list args) { const char* StringsStorage::GetName(Name* name) { if (name->IsString()) { String* str = String::cast(name); - int length = Min(kMaxNameSize, str->length()); + int length = Min(FLAG_heap_snapshot_string_limit, str->length()); int actual_length = 0; std::unique_ptr data = str->ToCString( DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL, 0, length, &actual_length); diff --git a/src/profiler/strings-storage.h b/src/profiler/strings-storage.h index d73a9dd208..834b5a3335 100644 --- a/src/profiler/strings-storage.h +++ b/src/profiler/strings-storage.h @@ -31,8 +31,6 @@ class StringsStorage { const char* GetFunctionName(const char* name); private: - static const int kMaxNameSize = 1024; - static bool StringsMatch(void* key1, void* key2); const char* AddOrDisposeString(char* str, int len); base::CustomMatcherHashMap::Entry* GetEntry(const char* str, int len);