| zhuyifei1999 added a comment. |
Test code:
diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py index ce018a2..16f8f12 100755 --- a/scripts/weblinkchecker.py +++ b/scripts/weblinkchecker.py @@ -1009,6 +1009,18 @@ def main(*args): gen = pagegenerators.RedirectFilterPageGenerator(gen) bot = WeblinkCheckerRobot(gen, HTTPignore, config.weblink_dead_days) try: + import signal + + def on_interactreq(signum, frame): + with bot.history.semaphore: + import code + from guppy import hpy + l = {'bot': bot, 'hpy': hpy} + l.update(globals()) + l.update(locals()) + code.interact(local=l) + signal.signal(signal.SIGUSR1, on_interactreq) + bot.run() finally: waitTime = 0
>>> hpy().heap() Partition of a set of 1792800 objects. Total size = 225903392 bytes. Index Count % Size % Cumulative % Kind (class / dict of class) 0 751854 42 123489224 55 123489224 55 unicode 1 240731 13 33477528 15 156966752 69 list 2 347177 19 28436720 13 185403472 82 tuple 3 2943 0 15730536 7 201134008 89 dict (no owner) 4 305817 17 7339608 3 208473616 92 float 5 77525 4 6901360 3 215374976 95 str 6 11373 1 1455744 1 216830720 96 types.CodeType 7 11074 1 1328880 1 218159600 97 function 8 401 0 1144472 1 219304072 97 dict of module 9 995 0 897480 0 220201552 97 type <417 more rows. Type e.g. '_.more' to view.> >>> h = _ >>> _.more Index Count % Size % Cumulative % Kind (class / dict of class) 10 995 0 829640 0 221031192 98 dict of type 11 24725 1 593400 0 221624592 98 int 12 326 0 348560 0 221973152 98 dict of class 13 281 0 294488 0 222267640 98 dict of cookielib.Cookie 14 92 0 256160 0 222523800 99 dict of pkg_resources._vendor.pyparsing.Literal 15 240 0 251520 0 222775320 99 dict of pywikibot.page.Link 16 828 0 231840 0 223007160 99 dict of function 17 758 0 212240 0 223219400 99 dict of pywikibot.site._IWEntry 18 109 0 173368 0 223392768 99 dict of pkg_resources._vendor.pyparsing.And 19 1707 0 150216 0 223542984 99 __builtin__.weakref <407 more rows. Type e.g. '_.more' to view.> >>> h[0].byid Set of 751854 <unicode> objects. Total size = 123489224 bytes. Index Size % Cumulative % Representation (limited) 0 309552 0.3 309552 0.3 u'{{Souh...e 2017]]' 1 158120 0.1 467672 0.4 u"==Vl\x...l|2011]]" 2 142360 0.1 610032 0.5 u'{{Info...011bla]]' 3 94040 0.1 704072 0.6 u"{{Kale...:Srpen]]" 4 73872 0.1 777944 0.6 u'{{Info...vision]]' 5 68184 0.1 846128 0.7 u'{{Souh...grafie]]' 6 61456 0.0 907584 0.7 u'\nThis...tch.\n\n' 7 59720 0.0 967304 0.8 u'GENERA...match.\n' 8 54128 0.0 1021432 0.8 u'{{Info...u 2007]]' 9 53520 0.0 1074952 0.9 u'[[Soub...fdroba]]' <751844 more rows. Type e.g. '_.more' to view.> >>> _.more Index Size % Cumulative % Representation (limited) 10 47736 0.0 1122688 0.9 u'{{Info...e 1989]]' 11 47552 0.0 1170240 0.9 u'{{Souh...oprava]]' 12 42344 0.0 1212584 1.0 u"{{Souh...oprava]]" 13 40472 0.0 1253056 1.0 u'\'\'\'...eaving]]' 14 39584 0.0 1292640 1.0 u'Jako \...egendy]]' 15 35088 0.0 1327728 1.1 u'{{Info... filmy]]' 16 32176 0.0 1359904 1.1 u"{{Souh...oprava]]" 17 32088 0.0 1391992 1.1 u"'''32....summit]]" 18 31648 0.0 1423640 1.2 u'{{Info...011bla]]' 19 31472 0.0 1455112 1.2 u'{{Souh...grafie]]' <751834 more rows. Type e.g. '_.more' to view.> >>>Guppy seems to guess that a majority of memory usage is wikitext.
TASK DETAIL
EMAIL PREFERENCES
To: zhuyifei1999
Cc: gerritbot, Dalba, Xqt, Zoranzoki21, zhuyifei1999, Aklapper, pywikibot-bugs-list, Dvorapa, Giuliamocci, Adrian1985, Cpaulf30, Baloch007, Darkminds3113, Lordiis, Adik2382, Th3d3v1ls, Ramalepe, Liugev6, Magul, Tbscho, rafidaslam, MayS, Lewizho99, Mdupont, JJMC89, Maathavan, Avicennasis, jayvdb, Masti, Alchimista, Rxy
Cc: gerritbot, Dalba, Xqt, Zoranzoki21, zhuyifei1999, Aklapper, pywikibot-bugs-list, Dvorapa, Giuliamocci, Adrian1985, Cpaulf30, Baloch007, Darkminds3113, Lordiis, Adik2382, Th3d3v1ls, Ramalepe, Liugev6, Magul, Tbscho, rafidaslam, MayS, Lewizho99, Mdupont, JJMC89, Maathavan, Avicennasis, jayvdb, Masti, Alchimista, Rxy
_______________________________________________ pywikibot-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs
