<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>[MStn CE U14] VBA and COM/Interop does not release memory</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/201080/mstn-ce-u14-vba-and-com-interop-does-not-release-memory</link><description>Hi, 
 based on question for help and analysis that I received from my friend, I think I have to report critical bug in (I think) COM API: 
 Element class does not release memory when not used, so MicroStation consumes more and more memory until it crashes</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: [MStn CE U14] VBA and COM/Interop does not release memory</title><link>https://communities.bentley.com/thread/621880?ContentTypeID=1</link><pubDate>Wed, 25 Nov 2020 13:08:35 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:c68c4ffc-05b4-429d-b21a-11c046a96289</guid><dc:creator>Artur Goldsweer</dc:creator><description>&lt;p&gt;Hi Jan,&lt;/p&gt;
&lt;p&gt;from my own tests it looks very good. Please let us know if you still experience any issue.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Artur&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [MStn CE U14] VBA and COM/Interop does not release memory</title><link>https://communities.bentley.com/thread/621791?ContentTypeID=1</link><pubDate>Wed, 25 Nov 2020 05:33:29 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:0b2338e8-e390-49a0-9e3a-dd8566a10cf6</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;Hi Artur,&lt;/p&gt;
&lt;p&gt;I see defect 1104232 in &lt;a href="/products/microstation/w/microstation__wiki/52268/resolved-issues-in-microstation-connect-edition-update-15-10-15-00-74" rel="noopener noreferrer" target="_blank"&gt;a list of Update 15 fixes&lt;/a&gt;. That&amp;#39;s great, thanks!&lt;/p&gt;
&lt;p&gt;I hope I will find some free time to be able to test it using the code I used in the past, to confirm it&amp;#39;s really fixed ;-)&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [MStn CE U14] VBA and COM/Interop does not release memory</title><link>https://communities.bentley.com/thread/601511?ContentTypeID=1</link><pubDate>Fri, 31 Jul 2020 07:12:24 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:b279fcd4-965d-41c3-92cf-76d5210a2a0b</guid><dc:creator>Artur Goldsweer</dc:creator><description>[quote userid="2473" url="~/products/programming/microstation_programming/f/microstation-programming---forum/201080/mstn-ce-u14-vba-and-com-interop-does-not-release-memory/601510"] it will be fixed in the next (Update 15?) release.[/quote]
&lt;p&gt;Hi Jan,&lt;/p&gt;
&lt;p&gt;it is not yet confirmed, but Update 15 is set as target for this fix.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Artur&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [MStn CE U14] VBA and COM/Interop does not release memory</title><link>https://communities.bentley.com/thread/601510?ContentTypeID=1</link><pubDate>Fri, 31 Jul 2020 07:06:57 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:fe9acc03-95fb-426f-819a-d8402b7ef5d4</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;Hi Artur,&lt;/p&gt;
&lt;p&gt;thanks a lot for the bug confirmation.&lt;/p&gt;
&lt;p&gt;I will create Service Ticket to be assigned to the defect number.&lt;/p&gt;
&lt;p&gt;I hope, because it has high priority and possible impact on every VBA or Interop code, it will be fixed in the next (Update 15?) release.&lt;/p&gt;
&lt;p&gt;With regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [MStn CE U14] VBA and COM/Interop does not release memory</title><link>https://communities.bentley.com/thread/601508?ContentTypeID=1</link><pubDate>Fri, 31 Jul 2020 07:00:31 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:a45d255f-6c1e-4b5f-9419-1ae4d1831b96</guid><dc:creator>Artur Goldsweer</dc:creator><description>&lt;p&gt;Hi Jan,&lt;/p&gt;
&lt;p&gt;this issue is reproducible and is a regression from V8i. Each assignment of an element object let grow the amount of used memory, so a file with just one single element and repeated assignment can be used to&amp;nbsp;reproduce this issue.&lt;/p&gt;
&lt;p&gt;We&amp;nbsp;have filed Defect &lt;strong&gt;1104232&lt;/strong&gt; with High priority to address this issue.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Artur&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [MStn CE U14] VBA and COM/Interop does not release memory</title><link>https://communities.bentley.com/thread/601175?ContentTypeID=1</link><pubDate>Thu, 30 Jul 2020 05:35:00 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:2769204a-68d0-469e-9dc4-06a3d9d7ae3e</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;BTW Another &amp;quot;safe method&amp;quot; how to exhaust memory or crash MicroStation soon is to use the file I shared and to select all elements several times. &lt;/p&gt;
&lt;p&gt;I have to appreciate (I guess it&amp;#39;s &lt;a href="/members/25ea930e_2d00_a6ae_2d00_4adf_2d00_b934_2d00_5f786560abd0"&gt;Sunand Sandurkar&lt;/a&gt; team effort) MicroStation is able to select 1 mil. of elements now, even with Properties dialog opened (but it requires long time).&lt;/p&gt;
&lt;p&gt;When I select all elements and deselect again and repeat this step, MicroStation consumes more and more memory. It&amp;#39;s (again) not freed even when the file is closed in backstage. The difference with and without Properties dialog opened is only in amount of memory added to already used (and with Properties dialog it takes much longer).&lt;/p&gt;
&lt;p&gt;I am not sure whether it is related internally to my original problem, but it&amp;#39;s another issue with memory allocation I found during my testing.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [MStn CE U14] VBA and COM/Interop does not release memory</title><link>https://communities.bentley.com/thread/601168?ContentTypeID=1</link><pubDate>Thu, 30 Jul 2020 05:17:33 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:81cf4c5d-62a8-4f7d-a9b0-20b6ad88fd82</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;Thanks a lot.&lt;/p&gt;
&lt;p&gt;Using &lt;a href="https://slegr-my.sharepoint.com/:u:/g/personal/jan_slegr_labtech_cz/EWe3q2PcHtdPhzY6rlMTKr4Bdm-Zs4Al36lOzilHLG_Y7w?e=6VvqRy" rel="noopener noreferrer" target="_blank"&gt;this link&lt;/a&gt; (time expiration set) it&amp;#39;s possible to download DGN file I use for testing.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [MStn CE U14] VBA and COM/Interop does not release memory</title><link>https://communities.bentley.com/thread/601166?ContentTypeID=1</link><pubDate>Thu, 30 Jul 2020 05:06:12 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:bab33981-e167-46c7-9beb-936d86b620fc</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;Hi Jon,&lt;/p&gt;
&lt;p&gt;no, nothing change (I tried it already).&lt;/p&gt;
&lt;p&gt;From outside, without any knowledge what is &amp;quot;inside COM code&amp;quot;, it seems like memory is allocated and never released, even when VBA project is unloaded or the design file is closed (in such case, it looks like only the memory holding the file content is released).&lt;/p&gt;
&lt;p&gt;With regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [MStn CE U14] VBA and COM/Interop does not release memory</title><link>https://communities.bentley.com/thread/601105?ContentTypeID=1</link><pubDate>Wed, 29 Jul 2020 22:54:07 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:58e1e92d-80ab-4da9-8f3d-7d47922a09a0</guid><dc:creator>Jon Summers</dc:creator><description>[quote userid="2473" url="~/products/programming/microstation_programming/f/microstation-programming---forum/201080/mstn-ce-u14-vba-and-com-interop-does-not-release-memory"]Element class does not release memory when not used
&lt;pre&gt;Public Sub MemoryBenchmark2()
    Dim ee As ElementEnumerator
    Set ee = ActiveModelReference.Scan
    For i = 1 To 10
        Do While ee.MoveNext
            Dim el As Element
            Set el = ee.Current
        Loop
    Next
End Sub&lt;/pre&gt;[/quote]
&lt;p&gt;Does it make any difference if you explicitly free memory?&lt;/p&gt;
&lt;pre&gt;Public Sub MemoryBenchmark2()
    Dim ee As ElementEnumerator
    Set ee = ActiveModelReference.Scan
    For i = 1 To 10
        Do While ee.MoveNext
            Dim el As Element
            Set el = ee.Current
            &lt;span style="color:seagreen;"&gt;&amp;#39; Free memory&lt;/span&gt;
            Set el = Nothing
        Loop
    Next
End Sub&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [MStn CE U14] VBA and COM/Interop does not release memory</title><link>https://communities.bentley.com/thread/601069?ContentTypeID=1</link><pubDate>Wed, 29 Jul 2020 18:39:40 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:157ef337-7770-4394-a98b-1ec085dbb1e5</guid><dc:creator>Robert Hook</dc:creator><description>&lt;p&gt;Hi Jan,&lt;/p&gt;
&lt;p&gt;I wanted to make sure we identify the correct patient and I will queue this up to review asap and let you know.&lt;/p&gt;
&lt;p&gt;Thank you,&lt;br /&gt;Bob&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [MStn CE U14] VBA and COM/Interop does not release memory</title><link>https://communities.bentley.com/thread/601068?ContentTypeID=1</link><pubDate>Wed, 29 Jul 2020 18:32:38 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:fd25853a-d37e-4ff8-ac04-15a8bcc59fa7</guid><dc:creator>Jan Šlegr</dc:creator><description>[quote userid="2163" url="~/products/programming/microstation_programming/f/microstation-programming---forum/201080/mstn-ce-u14-vba-and-com-interop-does-not-release-memory/601059"]Are you using just and only the Memory column[/quote]
&lt;p&gt;Yes:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/343173/Memory_2D00_Benchmark_2D00_Task_2D00_1.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;But I also captured some details also (sorry for Czech GUI):&lt;/p&gt;
&lt;p&gt;When DGN with 1000x1000 elements array is opened:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/343173/Memory_2D00_Benchmark_2D00_01_2D00_AfterDgnOpened.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;After VBA 1 is finished (a lot of memory allocated):&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/343173/Memory_2D00_Benchmark_2D00_02_2D00_AfterVBA.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;When the file is closed and backstage is active (the most of memory is still not freed):&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/343173/Memory_2D00_Benchmark_2D00_03_2D00_DgnClosed_2800_backstage_2900_.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;When it would help, I can create memory dumps, but I think you should see similar behavior also.&lt;/p&gt;
&lt;p&gt;With regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [MStn CE U14] VBA and COM/Interop does not release memory</title><link>https://communities.bentley.com/thread/601059?ContentTypeID=1</link><pubDate>Wed, 29 Jul 2020 17:58:52 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:e4176442-0ab4-45c1-9da2-f4e3e263ca7d</guid><dc:creator>Robert Hook</dc:creator><description>&lt;p&gt;Hi Jan,&lt;/p&gt;
&lt;p&gt;Are you using just and only the Memory column, or are there others you have enabled and using to monitor (if so I would like to know which ones) so we are on the same page (no pun intended but fine if you like).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you,&lt;br /&gt;Bob&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [MStn CE U14] VBA and COM/Interop does not release memory</title><link>https://communities.bentley.com/thread/601057?ContentTypeID=1</link><pubDate>Wed, 29 Jul 2020 17:48:51 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:9a574cf1-e28e-4136-bb3f-bdaa4716a865</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;Hi Bob,&lt;/p&gt;
&lt;p&gt;thanks for your quick reaction.&lt;/p&gt;
&lt;p&gt;In this &amp;quot;first analysis iteration&amp;quot; I used Processes tab in Windows Task Manager and I did not any more advanced memory profiling (later maybe I will check what e.g. RedGate memory profiler tells about running process).&lt;/p&gt;
&lt;p&gt;I am aware (and I remember some detail blogs about this topic) memory reported by Task Manager is not exact what the application consumes, moreover the overall &amp;quot;memory allocation&amp;quot; is complex today ;-)&lt;/p&gt;
&lt;p&gt;But regardless this a bit primitive measurement, I was able to crash MicroStation (and Windows complained a lot) because exhausting all memory, using repeatedly run C# Interop code (and I assume I would be able to do the same using VBA code too).&lt;/p&gt;
&lt;p&gt;With regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [MStn CE U14] VBA and COM/Interop does not release memory</title><link>https://communities.bentley.com/thread/601055?ContentTypeID=1</link><pubDate>Wed, 29 Jul 2020 17:40:51 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:46a9b56c-930c-4f64-954f-a96bf4f310c2</guid><dc:creator>Robert Hook</dc:creator><description>&lt;p&gt;Hi &lt;a class="internal-link view-user-profile" href="/members/ff247d2f_2d00_7ed5_2d00_451a_2d00_b5b2_2d00_a6fc5dbbf405"&gt;Jan &amp;Scaron;legr&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;Do you mind sharing exactly which Task Manager (memory) fields you are providing this feedback on?&amp;nbsp; I am not discounting what you have provided, but we need to be certain what memory statistic is of concern since Windows Task manager at times does not provide an accurate indication of how application memory is used, consumed and released in various memory consumption (context) models.&lt;/p&gt;
&lt;p&gt;Thank you in advance and I will take a look,&lt;br /&gt;Bob&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>