IExportContext Memory Issues

IExportContext Memory Issues

ebarMLN7G
Enthusiast Enthusiast
530 Views
3 Replies
Message 1 of 4

IExportContext Memory Issues

ebarMLN7G
Enthusiast
Enthusiast

We are using ExportContext APIs to export geometry from large Revit model with multiple linked documents from Revit. We are running into cases where the memory usage grows throughout the process without going down. For example in one case, after opening the model the (Revit)process uses around 30GB of memory and by the time the export is finished, it's up to around 70GB. I have checked the direct memory usage of the addin, and it's nowhere close to that amount. So it seems like Revit is loading objects to memory without removing them. Would it be possible that our addin causing Revit to keep native objects on memory longer than what it should?

 

If yes, what are the objects that are safe to keep a reference to without causing memory issues? Should we in general avoid referencing Revit API classes on heap?

 

0 Likes
531 Views
3 Replies
Replies (3)
Message 2 of 4

Sean_Page
Collaborator
Collaborator

Seems to me that there isn't much chance to help you with what you've told us. I think sharing a portion of code or something else that lets us see what your doing more specifically is needed. Can you share more with us?

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
0 Likes
Message 3 of 4

jeremy_tammik
Alumni
Alumni

Dear Ehsan, 

 

Your Revit API discussion forum threads are no longer escalated to cases with DAS = Autodesk Developer Advocacy and Support, formerly ADN = Autodesk Developer Network. Any idea why? Did the registered email change?

 

Anyway, interesting question. I passed it on to the development team and will let you know what they have to say.

 

Happy weekend to all!

 

Cheers, 

 

Jeremy

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 4 of 4

jeremy_tammik
Alumni
Alumni

Initial response:  Based on some recent work in a related area, there is no reason to believe that there is a memory leak. I think that it is difficult to accurately measure memory consumption during export. So, for analysis of the reported problem, it would help a lot to understand the details of how the measurement was made. Since the projects contain links, one possible workaround could be to export each link individually (and maybe restart Revit each time). However, high memory usage is generally something to be expected with large models. Since API objects are mentioned, I would venture a guess that managed memory can compound the problem (because it is not released right away). (As a side note, I believe that memory allocation in general is done in such a way as to utilise more of the available physical memory, which means that the effect of freeing memory is not necessarily visible right away.)

 
Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes