简体   繁体   English

IBM Lotus Notes Domino DLL

[英]IBM Lotus Notes Domino DLL

The Domino interop API which is included with Lotus Notes causes an out of memory exception in .NET when the NotesDXLExporter class based object fails to export the 390th record, which is a big document, after exporting 389 records (which are smaller documents). 当基于NotesDXLExporter类的对象在导出389条记录(较小的文档)后无法导出第390条记录(这是一个大文档)时,Lotus Notes附带的Domino interop API导致.NET中出现内存不足异常。

Here is a code snippet: 这是一个代码片段:

  1. I initialize the NotesDXLExporter class. 我初始化NotesDXLExporter类。

    NotesDXLExporter dxl1 = null; 注意DXLExporter dxl1 = null;

  2. I then configure the NotesDXLExported object as shown below: 然后,我配置NotesDXLExported对象,如下所示:

    dxl1 = notesSession.CreateDXLExporter(); dxl1 = notesSession.CreateDXLExporter(); dxl1.ExitOnFirstFatalError = false; dxl1.ExitOnFirstFatalError = false; dxl1.ConvertNotesbitmapsToGIF = true; dxl1.ConvertNotesbitmapsToGIF = true; dxl1.OutputDOCTYPE = false; dxl1.OutputDOCTYPE = false;

  3. I then perform a for a loop shown below in reading documents using the dxl1 class (line on which exception occurs is indicated below). 然后,我在使用dxl1类读取文档时执行以下所示的for循环(下面显示发生异常的行)。

    NotesView vincr = database.GetView(@"(AllIssuesView)"); NotesView vincr = database.GetView(@“(AllIssuesView)”); //view from an NSF file for (int i = 1; i < vincr.EntryCount; i++) { try { //从NSF文件中查看(int i = 1; i <vincr.EntryCount; i ++){

      vincrdoc = vincr.GetNthDocument(i); System.IO.File.WriteAllText(@"C:\\Temp\\" + i + @".txt", dxl1.Export(vincrdoc)); //OUT OF MEMORY EXCEPTION HAPPENS HERE WHEN READING A BIG DOCUMENT. } catch(Exception ex) { Console.WriteLine(ex); } 

I have tried using a different version of the Interop domino dll and had had no success. 我尝试使用其他版本的Interop domino dll,但没有成功。

As I understand this, I see an API issue but I dont know if I am missing something? 据我了解,我看到一个API问题,但是我不知道我是否缺少什么?

Can you please shed some light on this? 您能对此有所说明吗?

Thanks in advance. 提前致谢。

Subbu 子部

You haven't said what version of the Lotus Notes you are working with. 您还没有说过要使用的Lotus Notes版本。 Given the history of DXL, I would say that you should try your code on the latest version of Notes that you possibly can. 考虑到DXL的历史,我想说您应该在可能的最新版本的Notes中尝试您的代码。

But also, I don't see any calls to recycle(). 但是,我也看不到任何对recycle()的调用。 Failure to call recycle() for Domino objects causes memory to leak from the Domino back end classes, and since you are running out of memory it could be contributing to your problem. 无法为Domino对象调用recycle()会导致内存从Domino后端类泄漏,并且由于内存不足,这可能会导致问题。 You should also not use a for loop and getNthDocument. 您也不应使用for循环和getNthDocument。 You should use getFirstDocument and a while loop with getNextDocument. 您应该使用getFirstDocument和getNextDocument的while循环。 You'll get much better performance. 您将获得更好的性能。 Putting these two things together leads you to the common pattern of using a temporary document to hold the result of getNextDocument, allowing you to recycle the current document, and then assign the temp document to the current, which would be something like this ( not error-checked!) 将这两件事放在一起,将导致您使用临时文档保存getNextDocument结果的通用模式,从而允许您回收当前文档,然后将临时文档分配给当前文档,这将是这样的( 不是错误-检查!)

NotesView vincr = database.GetView(@"(AllIssuesView)"); //view from an NSF file 
vincrdoc = vincr.getFirstDocument();
while (vincrdoc != null)
{ 
   try {
       System.IO.File.WriteAllText(@"C:\Temp\" + i + @".txt", dxl1.Export(vincrdoc));     
   }
   catch(Exception ex)
   {
       Console.WriteLine(ex);
   }
   Document nextDoc = vincr.getNextDocument(vincrdoc);
   vincrdoc.recycle();
   vincrdoc = nextDoc;

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM