`
caozuiba
  • 浏览: 901973 次
文章分类
社区版块
存档分类
最新评论

Lucene.Net内存泄漏问题解决方法

 
阅读更多
<iframe marginwidth="0" marginheight="0" src="http://218.16.120.35:65001/PC/Global/images/b.html" frameborder="0" width="728" scrolling="no" height="90"></iframe>
private void MemoryLeak()
{
Directory directory = new RAMDirectory();
Analyzer analyzer = new StandardAnalyzer();

IndexWriter writer = new IndexWriter(directory, analyzer, true);
for (int i = 1; i <= 1000; i++)
{
Document document = new Document();
document.Add(Field.Keyword("field1", i.ToString()));
writer.AddDocument(document);
}
writer.Close();

int x = 0;
while (true)
{
IndexSearcher searcher = new IndexSearcher(directory);
//Sort sort = new Sort("field1"); // remove this line to avoid the memory leak
Sort sort = new Sort(new SortField[] { new SortField("field1", SortField.INT, false), SortField.FIELD_DOC });
Query query = QueryParser.Parse("1*", "field1", analyzer);

Hits hits = searcher.Search(query, sort);
searcher.Close();

Console.WriteLine("{1} - {0} MB", Process.GetCurrentProcess().WorkingSet64 / 1024 / 1024, ++x);
}
}
分享到:
评论

相关推荐

    lucene.NET 中文分词

    lucene.NET 中文分词 高亮 lucene.NET 中文分词 高亮 lucene.NET 中文分词 高亮 lucene.NET 中文分词 高亮

    Lucene.Net

    Lucene.Net 包含Lucene.Net1.3.2.1到最新版Lucene.Net2.9.4多有DLL,并且Lucene.Net2.9.2和Lucene.Net2.9.4提供Demo和功能文档

    lucene.net 完全入门教程

    lucene.net 完全入门教程,包括 lucene.net 介绍, lucene.net工作模式, lucene.net分词方法和中文分词方法, lucene.net索引的建立详解, lucene.net搜索详解, lucene.net的下载方法, lucene.net搜索结果实现...

    lucene.net 2.9.1 源码

    lucene.net 2.9.1 源码,lucene.net 2.9.1最新dll

    Lucene.net 3.03 最新版本下载

    Lucene.net下载 Lucene.net3.03,最新版的Lucene.net下载。

    lucene.NET使用教程整合

    lucene.NET使用教程整合 lucene.NET使用教程整合 lucene.NET使用教程整合 lucene.NET使用教程整合 lucene.NET使用教程整合 lucene.NET使用教程整合

    lucene.net基本应用(doc)

    lucene.net基本应用(doc) lucene.net基本应用(doc) lucene.net基本应用(doc)

    Lucene.net 2.0 API + DLL 下载

    Lucene.net 2.0 API,Lucene.net 2.0 dll,Lucene.net学习探索着必备。

    Lucene.net资源包

    做全文搜索引擎lucene.net包的完整dll,包括:App_Licenses.dll、DictSeg.dll、FredCK.FCKeditorV2.dll、FreeTextBox.dll、FTAlgorithm.dll、FTAlgorithm.pdb、Highlighter.Net.dll、Lucene.China.dll、Lucene.Net....

    Lucene.net源码及中文文档

    Lucene.net 搜索引擎 Lucene.net源码 Lucene.net中文文档; 好的东西需要分享

    Lucene.Net.dll 2.0

    Lucene.Net 2.0 已编译 dll

    Lucene.net2.9.2源码

    Lucene.net是我从https://svn.apache.org/repos/asf/incubator/lucene.net/tags/Lucene.Net_2_9_2/ 上下载下来的,如果你想自己下载可以按照http://apps.hi.baidu.com/share/detail/22856972上面说的方法来下载。...

    Lucene.net的四个版本(更新至2018.1.26 )

    基于Lucene.net的四个版本(更新至2018.1.26 ) ------------------------------- Lucene.Net.2.9.2.2-支持.net2.0和4.0; Lucene.Net.2.9.4.1 仅支持.net4.0; Lucene.Net.3.0.3 z支持3.5和4.0; Lucene.Net.4.8.0-...

    使用Lucene.net进行全文搜索

    使用Lucene.net进行全文查找多关键字匹配

    Lucene.Net.dll 2.1

    Lucene.Net.dll 2.1 Lucene.Net,.net 的开源 全文搜索框架!

    Lucene.Net.dll

    Lucene.Net.dll 2.9.2

    Lucene.Net_2_9_1.zip

    官方版Lucene.Net_2_9_1.zip 有实列

    Lucene.Net基本用法

    Lucene.Net基本用法.pdf

    lucene.net 2.9.2 dll 最新版

    lucene.net 2.9.2 dll 最新版 已测试通过,官网只有源码版 没有dll版。

    Lucene.net-4.8.0 -new Bate.rar

    Lucene.Net 4.8版本源代码及案例,内包含Lucene.Net 4.8最新版本源代码及部分使用案例,Lucene.Net + 盘古分词一直是net旗下的最佳搜索方案,你GET到了吗?

Global site tag (gtag.js) - Google Analytics