Community
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create a button to clear all active memory (similar to what CREO offers) so we don't have to restart Inventor.

Create a button to clear all active memory (similar to what CREO offers) so we don't have to restart Inventor.

Anytime I need to clear the active memory in Inventor I have to close and start a new session.  There should be a simple button on the ribbon somewhere (or in a dropdown) that allows a user to clear all active memory if they have no files open.  CREO offers this and it is a great tool to have!  .... Unless I'm missing something in Inventor and there is a way to clear active memory (I don't think there is)? 

34 Comments
Aubrey_Campbell
Advocate

... I meant to preface this request with a "Please" 😁

swalton
Mentor

swalton_0-1642779096697.png

 

Aubrey_Campbell
Advocate

That would close all files, but I'm pretty sure it does not clear the active memory.  Closing a file does not clear it from the active memory. 

swalton
Mentor

To the best of my knowledge, Inventor flushes memory of components when they are closed.  Of course, all files that reference a specific component must be closed before the component is flushed.  

 

 

 

Aubrey_Campbell
Advocate

Interesting.  Is there someone from Autodesk, who would know for sure, that can confirm this?  

 

If it is the case, it doesn't seem to work all the time.  I'm sure there are times in which I have had all files closed and not getting accurate output from changes to code until I restarted Inventor.  

 

Maybe, if closing is supposed to flush the memory, they give us the button anyway so we can manually do it in those instances active memory does not seem to have been cleared? 

ChrisMitchell01
Community Manager

The general goal is that closing a document will clear the memory that it was using but if there are cross-document references (eg a part in an assembly in a drawing etc) that are all open concurrently then yes, there's likely room for  memory mgmt improvements....

 

As you already know closing/restarting Inventor is currently the best way to clear memory usage; hence your idea.

 

Another good practice is to regularly delete everything from your %temp% folder, (after closing all running applications).

 

Thanks

Chris

Aubrey_Campbell
Advocate

Sounds like the Clear All Active Memory button has a practical use not currently being performed (at least not completely).  

 

.... Maybe it could even be a little more robust than just a 'clear memory button' and let the user know if something couldn't be cleared from memory because it is open somewhere, and what that something is. 

 

Thanks for your input @ChrisMitchell01 !

maxim.teleguz
Advocate

image.png

Aubrey_Campbell
Advocate

What interface is that?  I don't recognize it.  

 

Is that custom code?  ... only applies to the content center? 

 

.... Still need a button! 😁

maxim.teleguz
Advocate

@Aubrey_Campbell go to tools > VBA Editor > (when opened, go to View > Object Browser. Make sure to select Inventor In drop down)  

Aubrey_Campbell
Advocate

Ok, I see where you are.  However, I don't see the "ForceRefreshCache" option when I run a search for "cache"

 

Is that something custom?

Aubrey_Campbell_0-1643316408087.png

 

maxim.teleguz
Advocate

@Aubrey_Campbell right click show hidden members (sorry forgot to mention that)

Hi @ChrisMitchell01 @Aubrey_Campbell 

We are talking about this issue

nedeljkosovljanski_0-1643391740613.png

I have Assembly1, I created part11, deleted part and I want to create again part11 (that is ridiculous but it is not forbidden). Look at memory status

nedeljkosovljanski_1-1643391884974.png

In the memory I have part10 also and part11.

That must be solved finally.

Aubrey_Campbell
Advocate

 

 

@nedeljko.sovljanski,

 

It sounds like you have another good case for the creation of this button.  Please click the "Vote" button at the bottom of the first post to show the Autodesk team this is something they should escalate and look at. 

 

Aubrey_Campbell_0-1643393972960.png

 

 

Thanks for your input @nedeljko.sovljanski !!

 

 

 

 

@Aubrey_Campbell 

I have already voted, but I am worried, only 18 votes, Autodesk will not take that in consideration.

maxim.teleguz
Advocate

@nedeljko.sovljanski 

I believe I have exposed how Autodesk clears the cache:

DocumentObject gets set to Nothing when inventor closes that Document. I believe What I need to do is rewrite this code to say for All Documents in ThisDoc.Document or something like that and then run these codes on it. 

 

 

 

 

Sub Main ClearCache()
Dim oDoc As Document = ThisDoc.Document
oDoc.ReleaseReference
'Application.ExitThread
oDoc = Nothing
DocumentObject = Nothing
uiEvents = Nothing
inventorApplication = Nothing
AppEvents = Nothing
oFileDlgEvents = Nothing

Try
System.Runtime.InteropServices.Marshal.ReleaseThreadCache
'System.Runtime.InteropServices.Marshal.FreeCoTaskMem
'System.Runtime.InteropServices.Marshal.FreeBSTR
'System.Runtime.InteropServices.Marshal.FreeHGlobal

System.Runtime.InteropServices.Marshal.CleanupUnusedObjectsInCurrentContext
'System.Runtime.InteropServices.Marshal.Release
'System.Runtime.InteropServices.Marshal.ReleaseComObject
'System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeMarshal.FreeHString

'https://renenyffenegger.ch/notes/Microsoft/dot-net/namespaces-classes/System/Runtime/InteropServices/Marshal/index

'System.Runtime.InteropServices.Marshal.FreeHGlobal(inventorApplication)
Catch
	
End Try

'AccessibleObject = Nothing
'DataObject = Nothing

'Application.CutCopyMode = False
	
'System.GC.Collect()
'System.GC.WaitForPendingFinalizers()

'ThisApplication.kNeverSaveMemoryMode(True)
'ThisApplication.Documents.ReleaseReference
'ThisApplication.Documents.CloseAll(True)
End Sub

 

 

 

 

maximteleguz_0-1643406820777.png

 

@maxim.teleguz that is it, I am using ReleaseReference but what about regular user who just Inventor (not Ilogic, VBA or Addins)?

Aubrey_Campbell
Advocate

@nedeljko.sovljanski ,

 

My bad; I missed your vote at first glance.  Thank you for voting!!

 

It may take some time.  I have seen (recently) a topic go from "Gathering Support" to "Future Consideration" just a few weeks ago and the topic started back in 2013.  9 years later, this issue (link below) is finally being considered (hopefully).

 

 https://forums.autodesk.com/t5/inventor-ideas/mm-mm-in-in-dimensions/idi-p/4412041#comments

 

Hopefully we can get Autodesk to advance this topic much sooner than 9 years from now.  Either way, all is not lost, yet!

 

If you know any other users, please consider passing the link to this topic to them and encourage them to vote.  If enough of us do that, we may see action on this sooner rather than later. 

 

Thanks again, @nedeljko.sovljanski  

Aubrey_Campbell
Advocate

@maxim.teleguz ,

 

We want the button to be an actual button on a ribbon or a dropdown somewhere without having to hunt down and edit code.  This is very cumbersome for the average user (and prohibitive for some). 

 

Your method is probably good, but we still need a button! 

 

Thanks for the info! 

maxim.teleguz
Advocate

@nedeljko.sovljanski i updated my code just now. This works pretty well (no errors). But I cant seem to figure out how to get task manager to show the memory dropping not sure if it is working. do you have a way to test to see if inventor holds on to something after this code is run?

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea  

Autodesk Design & Make Report