Skip to content

Commit 0173bef

Browse files
committed
Review by doc team
1 parent a121044 commit 0173bef

File tree

2 files changed

+172
-128
lines changed

2 files changed

+172
-128
lines changed

doc/tooling/luajit_memprof.rst

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Below is a chunk of Lua code named ``test.lua`` to illustrate this.
6262
end
6363
local str, err = misc.memprof.stop()
6464
65-
The Lua code for starting the profiler -- as in line 3 in the test.lua example above -- is:
65+
The Lua code for starting the profiler -- as in line 3 in the ``test.lua`` example above -- is:
6666

6767
.. code-block:: lua
6868
@@ -77,14 +77,14 @@ an error-message string as the second result,
7777
and a system-dependent error code number as the third result.
7878
If the operation succeeds, ``misc.memprof.start()`` returns ``true``.
7979

80-
The Lua code for stopping the profiler -- as in line 18 in the test.lua example above -- is:
80+
The Lua code for stopping the profiler -- as in line 18 in the ``test.lua`` example above -- is:
8181

8282
.. code-block:: lua
8383
8484
local str, err = misc.memprof.stop()
8585
8686
If the operation fails,
87-
for example if there is an error when the file descriptor is being closed
87+
for example if there is an error when the file descriptor is being closed
8888
or if there is a failure during reporting,
8989
``misc.memprof.stop()`` returns ``nil`` as the first result,
9090
an error-message string as the second result,
@@ -203,21 +203,20 @@ An event record has the following format:
203203
.. code-block:: text
204204
205205
@<filename>:<line_number>: <number_of_events> events +<allocated> bytes -<freed> bytes
206-
207206
207+
where:
208208

209-
* <filename>a name of the file containing Lua code.
210-
* <line_number>the line number where the event is detected.
211-
* <number_of_events>a number of events for this code line.
212-
* +<allocated> bytesamount of memory allocated during all the events on this line.
213-
* -<freed> bytesamount of memory freed during all the events on this line.
209+
* ``<filename>`` -— a name of the file containing Lua code.
210+
* ``<line_number>`` -— the line number where the event is detected.
211+
* ``<number_of_events>`` —- a number of events for this code line.
212+
* ``+<allocated> bytes`` —- amount of memory allocated during all the events on this line.
213+
* ``-<freed> bytes`` —- amount of memory freed during all the events on this line.
214214

215215
The ``Overrides`` label shows what allocation has been overridden.
216216

217217
See the :ref:`test.lua chunk above <profiler_usage_example01>`
218218
with the explanation in the comments for some examples.
219219

220-
221220
.. _profiler_usage_internal_jitoff:
222221

223222
The ``INTERNAL`` label indicates that this event is caused by internal LuaJIT
@@ -423,9 +422,9 @@ you will get the following profiling report:
423422
424423
Reasonable questions regarding the report can be:
425424

426-
* Why are there no allocations related to the ``concat()`` function?
427-
* Why is the number of allocations not a round number?
428-
* Why are there about 20K allocations instead of 10K?
425+
* Why are there no allocations related to the ``concat()`` function?
426+
* Why is the number of allocations not a round number?
427+
* Why are there about 20K allocations instead of 10K?
429428

430429
First of all, LuaJIT doesn't create a new string if the string with the same
431430
payload exists (see details on `lua-users.org/wiki <http://lua-users.org/wiki/ImmutableObjects>`_).
@@ -494,8 +493,6 @@ allocations are JIT-related (see also the related
494493
@format_concat.lua:0 holds 640 bytes: 4 allocs, 0 frees
495494
INTERNAL holds 360 bytes: 2 allocs, 1 frees
496495
497-
498-
499496
This happens because a trace has been compiled after 56 iterations (the default
500497
value of the ``hotloop`` compiler parameter). Then, the
501498
JIT-compiler removed the unused variable ``c`` from the trace, and, therefore,

0 commit comments

Comments
 (0)