A Scalable, User-Friendly Source Control System.
Go to file
Gregory Szorc 90a75c9c65 transaction: delete callbacks after use
Before this change, localrepository instances that performed multiple
transactions would leak transaction objects. This could occur when
running `hg convert`. When running `hg convert`, the leak would be
~90 MB per 10,000 changesets as measured with the Mercurial repo itself.

The leak I tracked down involved the "validate" closure from
localrepository.transaction(). It appeared to be keeping a
reference to the original transaction via __closure__. __del__
semantics and a circular reference involving the repo object
may have also come into play.

Attempting to refactor the "validate" closure proved to be
difficult because the "tr" reference in that closure may
reference an object that isn't created until transaction.__init__
is called. And the "validate" closure is passed as an argument to
transaction.__init__. Plus there is a giant warning comment in
"validate" about how hacky it is. I did not want to venture into
the dragon den.

Anyway, we've had problems with transactions causing leaks before.
The solution then (8b23c334b97f) is the same as the solution in this
patch: drop references to callbacks after they are called. This
not only breaks cycles in core Mercurial but can help break cycles
in extensions that accidentally introduce them.

While I only tracked down a leak due to self.validator, since this is
the 2nd time I've tracked down leaks due to transaction callbacks I
figure enough is enough and we should prevent the class of leak from
occurring regardless of the variable. That's why all callback variables
are now nuked.
2017-05-26 13:27:21 -07:00
contrib perf: benchmark command for revlog indexes 2017-05-28 11:13:10 -07:00
doc doc: port check-seclevel.py to be Python 2/3 portable 2017-05-28 15:51:26 -04:00
hgdemandimport demandimport: look for 'mod' suffix as alternative name for module reference 2017-04-28 23:46:16 +09:00
hgext cmdutil: rename template param to export to fntemplate 2017-05-20 20:15:05 -04:00
hgext3rd extensions: also search for extension in the 'hgext3rd' package 2016-03-11 10:30:08 +00:00
i18n i18n-ja: synchronized with 878ab1a44c7e 2017-05-01 07:23:29 +09:00
mercurial transaction: delete callbacks after use 2017-05-26 13:27:21 -07:00
tests tests: make test-manifest.py portable to Python 3 2017-05-28 21:31:29 -04:00
.editorconfig mercurial: add editorconfig 2016-04-05 18:10:33 +01:00
.hgignore make: drop deprecated rule to process temporary copy of pure modules 2016-08-12 11:36:42 +09:00
.hgsigs Added signature for changeset 2e4bacde4889 2017-05-02 17:09:00 -05:00
CONTRIBUTING contributing: add new file with a pointer to the wiki 2016-10-08 10:39:00 -04:00
CONTRIBUTORS Add note to CONTRIBUTORS file 2007-11-07 21:10:30 -06:00
COPYING COPYING: refresh with current address from fsf.org 2011-06-02 11:17:02 -05:00
hg init: turn on demandimport for Python 3.6 and above 2017-05-21 12:51:01 -07:00
hgeditor spelling: trivial spell checking 2015-10-17 00:58:46 +02:00
hgweb.cgi urls: bulk-change primary website URLs 2015-09-30 15:43:49 -05:00
Makefile zsh_completion: install as _hg not hg 2017-05-26 13:24:07 -07:00
README urls: bulk-change primary website URLs 2015-09-30 15:43:49 -05:00
setup.py cffi: put compiled modules into mercurial.cffi package 2017-05-02 21:08:38 +09:00

Mercurial
=========

Mercurial is a fast, easy to use, distributed revision control tool
for software developers.

Basic install:

 $ make            # see install targets
 $ make install    # do a system-wide install
 $ hg debuginstall # sanity-check setup
 $ hg              # see help

Running without installing:

 $ make local      # build for inplace usage
 $ ./hg --version  # should show the latest version

See https://mercurial-scm.org/ for detailed installation
instructions, platform-specific notes, and Mercurial user information.