English 中文(简体)
在处理大量案文时防止记忆问题
原标题:Preventing Memory issues when handling large amounts of text
  • 时间:2009-09-15 14:08:16
  •  标签:

我编制了一个分析项目源代码的方案,并根据该守则报告各种问题和衡量标准。

为了分析源代码,我把项目目录结构中存在的代码文档从记忆中分析代码。 守则经过广泛的处理,然后通过其他方法进一步分析。

守则在经过处理后将采用几类。

另一天,我执行该项目,是我的小组开展的大型项目之一,我的方案对我很抱歉,因为有许多来源的法典被装上记忆。 目前,这是一个独角兽案件,但我希望今后能够处理这个问题。

避免记忆问题的最佳途径是什么?

我不想装上该代码,而是初步处理文件,然后将结果编成光盘,这样,当我需要再次查阅时,我就不必再继续操纵该原材料。 这是否有意义? 或者,序列化/代相形化会更昂贵,然后再处理法典?

我想在处理这一问题时保持合理的业绩水平。 大部分时间,源代码将毫无问题地保存,因此,如果我记忆犹豫不决,我的信息只能“页”。 是否有办法说明我的申请在记忆中处于低水平?

Update: The problem is not that a single file fills memory, its all of the files in memory at once fill memory. My current idea is to rotate off the disk drive when I process them

最佳回答

1.6 基于性别的暴力仍然可以管理,其本身不应造成记忆问题。 低效率的增援行动可能这样做。

As you parse the source code your probably split it apart into certain substrings - tokens or whatver you call them. If your tokens combined account for entire source code, that doubles memory consumption right there. Depending on the complexity of the processing you do the mutiplier can be even bigger. My first move here would be to have a closer look on how you use your strings and find a way to optimize it - i.e. discarding the origianl after the first pass, compress the whitespaces, or use indexes (pointers) to the original strings rather than actual substrings - there is a number of techniques which can be useful here.

如果这无一助,我就不去掉他们,把他们拖到磁盘上。

问题回答

如果问题在于,如果贵国的法典有一份副本,使你能够填补现有的记忆,则有两种选择。

  • serialize to disk
  • compress files in memory. If you have a lot of CPU it can be faster to zip and unzip information in memory, instead of caching to disk.

如果你妥善处置物体,你也应进行检查。 您的记忆有问题,因为旧的物体正记忆中?

利用WinDbg与SOS一起,看看看看看看看看哪些内容(或曾经导致极端记忆的使用)。

象一个好的战略一样,使音响民主化。 我做了大量的工作,而且速度非常快。 事实上,我有这样的信息,即从一个行当的物体,然后将其序列化到我的网络节点的硬盘。 这是自我制定基准以来的一段时期,但是,在我进行负荷测试时,它正在把几百个第二位编成序,可能超过1k。

当然,这将取决于你的法典档案的大小。 我的档案相当少。





相关问题
热门标签