History

V8 heap object statistics

ksuprynowicz committed 3 years ago

Commit a57c7a51 parent 6466d396 files · +74 −14Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.h (1 of 6 files). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.h+13−2
@@ -27,7 +27,8 @@ · 26 unmodified lines
2727 #include "ScriptException.h"
2828
2929 // These are used for debugging memory leaks caused by persistent handles
30−#define OVERTE_V8_HANDLE_COUNTERS
30+// V8TODO: Rename to something better, like for example OVERTE_V8_MEMORY_DEBUG
31+#define OVERTE_V8_MEMORY_DEBUG
3132
3233 class QByteArray;
3334 class QLatin1String;
@@ -56,7 +57,7 @@ public: · 22 unmodified lines
5657 size_t totalAvailableSize;
5758 size_t totalGlobalHandlesSize;
5859 size_t usedGlobalHandlesSize;
59−#ifdef OVERTE_V8_HANDLE_COUNTERS
60+#ifdef OVERTE_V8_MEMORY_DEBUG
6061 size_t scriptValueCount;
6162 size_t scriptValueProxyCount;
6263 #endif
@@ -399,6 +400,16 @@ public: · 336 unmodified lines
399400 */
400401 virtual ScriptEngineMemoryStatistics getMemoryUsageStatistics() = 0;
401402
403+ /**
404+ * @brief Start collecting object statistics that can later be reported with dumpHeapObjectStatistics().
405+ */
406+ virtual void startCollectingObjectStatistics() = 0;
407+
408+ /**
409+ * @brief Prints heap statistics to a file. Collecting needs to first be started with dumpHeapObjectStatistics().
410+ */
411+ virtual void dumpHeapObjectStatistics() = 0;
412+
402413 public:
403414 // helper to detect and log warnings when other code invokes QScriptEngine/BaseScriptEngine in thread-unsafe ways
404415 bool IS_THREADSAFE_INVOCATION(const QString& method);