为什么这个python脚本内存不足?

时间:2014-07-14 23:05:30

标签: java python memory minecraft decompiler

我对Python几乎一无所知,所以我来这里问你们如何改变这一点。我将提供文件片段,这应该是解决这个问题所需的全部内容。

main.py - 执行所有日志记录,完成所有操作

commands.logger.info('> Applying SpecialSource')
        commands.applyss(side, keep_lvt=keep_lvt, keep_generics=keep_generics)

commands.py - 拥有所有defs

def applyss(self, side, reobf=False, srg_names=False, in_jar=None, out_jar=None, keep_lvt=False, keep_generics=False):
        """Apply ss to the given side"""
        cplk = {CLIENT: self.cpathclient, SERVER: self.cpathserver}
        cfgsrg  = {CLIENT: self.srgsclient, SERVER: self.srgsserver}
        deobsrg = {CLIENT: self.deobsrgclient, SERVER: self.deobsrgserver}
        reobsrg = {CLIENT: self.reobsrgclient, SERVER: self.reobsrgserver}
        rsrgsrg = {CLIENT: self.reobsrgclientsrg, SERVER: self.reobsrgserversrg}
        if in_jar is None:
            if reobf:
                in_jar = {CLIENT: self.cmpjarclient, SERVER: self.cmpjarserver}[side]
            else:
                in_jar = {CLIENT: self.jarclient, SERVER: self.jarserver}[side]
        if out_jar is None:
            if reobf:
                out_jar = {CLIENT: self.reobfjarclient, SERVER: self.reobfjarserver}[side]
            else:
                out_jar = {CLIENT: self.rgclientout, SERVER: self.rgserverout}[side]
        if reobf:
            cmd = self.cmdssreobf
            if srg_names:
                identifier = 'RGMCPSRG'
                srg = rsrgsrg[side]
            else:
                identifier = 'RGMCP'
                srg = reobsrg[side]
        else:
            cmd = self.cmdss
            identifier = None
            srg = cfgsrg[side]
        # add specialsource.jar to copy of client or server classpath
        sscp = [self.specialsource] + cplk[side]
        sscp = os.pathsep.join(sscp)
        forkcmd = cmd.format(classpath=sscp, injar=in_jar, outjar=out_jar, identifier=identifier, mapfile=srg)
        if not keep_lvt:
            forkcmd += ' --kill-lvt'
        if not keep_generics:
            forkcmd += ' --kill-generics'
        try:
            self.runcmd(forkcmd)
            if not reobf:
                shutil.copyfile(cfgsrg[side], deobsrg[side])
                shutil.copyfile(deobsrg[side], reobsrg[side])
        except CalledProcessError as ex:
            self.logger.error('')
            self.logger.error('== ERRORS FOUND ==')
            self.logger.error('')
            for line in ex.output.splitlines():
                if line.strip():
                    if line[0] != '#':
                        self.logger.error(line)
            self.logger.error('==================')
            self.logger.error('')
            raise

如果您还没有弄明白,那就是MCP或Minecraft Coder Pack。问题是,在反编译服务器jar时,它会在> Applying SpecialSource阶段耗尽内存。我不知道它在哪里说java -jar SpecialSource.jar或其他任何东西,并希望你能告诉我在哪里寻找它。

1 个答案:

答案 0 :(得分:1)

检查你的python是否是最新的,以及你运行的操作系统是什么?我遇到了这个问题,它是过时软件的混合体,MCP错误地将一些库用于Windows,所以事情搞砸了。如果您使用的是mac / linux,请在MCP文件夹中搜索Windows,并使用您的操作系统名称替换Windows。这对我有用。