Mercurial > hg
annotate tests/test-rebase-empty-successor.t @ 47343:9f798c1b0d89 stable
cext: fix memory leak in phases computation
Without this a buffer whose size in bytes is the number of
changesets in the repository is leaked each time the repository is
opened and changeset phases are computed.
Impact: the current code in hgwebdir creates a new `localrepository`
instance for each HTTP request. Since any pull or push is made of several
requests, a team of 100 people can easily produce thousands of such
requests per day.
Being a low-level malloc, this leak can't be seen with the gc module and
tools relying on that, but was spotted by valgrind immediately.
Reproduction
------------
for i in range(cl_args.iterations):
repo = hg.repository(baseui, repo_path)
rev = repo.revs(rev).first()
ctx = repo[rev]
del ctx
del repo
# avoid any pollution by other type of leak
# (that should be fixed in 5.8)
repoview._filteredrepotypes.clear()
gc.collect()
Measurements
------------
Resident Set Size (RSS), taken on a clone of
mozilla-central for performance analysis (440 000
changesets).
before:
5.8+hg19.5ac0f2a8ba72 1000 iterations: 1606MB
5.8+hg19.5ac0f2a8ba72 10000 iterations: 5723MB
after:
5.8+hg20.e2084d39e145 1000 iterations: 555MB
5.8+hg20.e2084d39e145 10000 iterations: 555MB
(double checked, not a copy/paste error)
(e2084d39e14 is the present changeset, before amendment
of the message to add the measurements)
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Sun, 06 Jun 2021 01:24:30 +0200 |
parents | f90a5c211251 |
children |
rev | line source |
---|---|
45123
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
1 $ cat << EOF >> $HGRCPATH |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
2 > [extensions] |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
3 > rebase= |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
4 > [alias] |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
5 > tglog = log -G -T "{rev} '{desc}'\n" |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
6 > EOF |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
7 |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
8 $ hg init |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
9 |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
10 $ echo a > a; hg add a; hg ci -m a |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
11 $ echo b > b; hg add b; hg ci -m b1 |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
12 $ hg up 0 -q |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
13 $ echo b > b; hg add b; hg ci -m b2 -q |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
14 |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
15 $ hg tglog |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
16 @ 2 'b2' |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
17 | |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
18 | o 1 'b1' |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
19 |/ |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
20 o 0 'a' |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
21 |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
22 |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
23 With rewrite.empty-successor=skip, b2 is skipped because it would become empty. |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
24 |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
25 $ hg rebase -s 2 -d 1 --config rewrite.empty-successor=skip --dry-run |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
26 starting dry-run rebase; repository will not be changed |
45771
f90a5c211251
rebase: change and standarize template for rebase's one-line summary
Martin von Zweigbergk <martinvonz@google.com>
parents:
45123
diff
changeset
|
27 rebasing 2:6e2aad5e0f3c tip "b2" |
f90a5c211251
rebase: change and standarize template for rebase's one-line summary
Martin von Zweigbergk <martinvonz@google.com>
parents:
45123
diff
changeset
|
28 note: not rebasing 2:6e2aad5e0f3c tip "b2", its destination already has all its changes |
45123
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
29 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
30 |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
31 With rewrite.empty-successor=keep, b2 will be recreated although it became empty. |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
32 |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
33 $ hg rebase -s 2 -d 1 --config rewrite.empty-successor=keep |
45771
f90a5c211251
rebase: change and standarize template for rebase's one-line summary
Martin von Zweigbergk <martinvonz@google.com>
parents:
45123
diff
changeset
|
34 rebasing 2:6e2aad5e0f3c tip "b2" |
f90a5c211251
rebase: change and standarize template for rebase's one-line summary
Martin von Zweigbergk <martinvonz@google.com>
parents:
45123
diff
changeset
|
35 note: created empty successor for 2:6e2aad5e0f3c tip "b2", its destination already has all its changes |
45123
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
36 saved backup bundle to $TESTTMP/.hg/strip-backup/6e2aad5e0f3c-7d7c8801-rebase.hg |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
37 |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
38 $ hg tglog |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
39 @ 2 'b2' |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
40 | |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
41 o 1 'b1' |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
42 | |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
43 o 0 'a' |
1efbfa9b36a7
rebase: consider rewrite.empty-successor configuration
Manuel Jacob <me@manueljacob.de>
parents:
diff
changeset
|
44 |