.. _stdlib_memory_profiler: =============== Memory Profiler =============== +++++++++++ Integration +++++++++++ - Add ``require engine.runtime.memory_profiler`` line to main script - Play the game - Exit the game or reload the script (``ctrl-shift-x``), profiling results will be printed to the log file +++++ Usage +++++ Open the log file in the game folder and find the line with ``memory used by context`` text. This line contains information about the total heap allocated by the script and the string heap allocated by the script. After that you can find the table with detailed information about a heap allocated by each function. +++++++++++++ Result sample +++++++++++++ .. thumbnail:: ../_static/images/memory_profiler/result_sample.png :alt: Result sample +++++++++++++ Table columns +++++++++++++ - ``function`` - the function name - ``heap (total)`` - a heap allocated by the function including its subfunctions - ``heap`` - a heap allocated by the function excluding its subfunctions - ``str (total)`` - a string heap allocated by the function including its subfunctions - ``strings`` - a string heap allocated by the function excluding its subfunctions - ``calls`` - a number of calls of the function - ``location`` - the location of function in the script file, line and function name