Where is the "Clear-Inventor-memory-without-restarting-the-application"-button?

Where is the "Clear-Inventor-memory-without-restarting-the-application"-button?

fridtjofZM5ME
Collaborator Collaborator
793 Views
5 Replies
Message 1 of 6

Where is the "Clear-Inventor-memory-without-restarting-the-application"-button?

fridtjofZM5ME
Collaborator
Collaborator

Working extensively with iLogic configurators, and especially those involving writing copies of files to disk, I've experienced that the code often runs smoothly only the first time. On the second attempt I very often get errors like this:

Skjermbilde 2022-06-28 095216.jpg

 

The only sure-fire way to resolve the issue is by restarting Inventor, which is somewhat tedious.

 

Is there a button somewhere that will flush the memory, so you can start over again without any in-memory remains of anything causing trouble? Or is there a snippet you can put somewhere that will do this?

0 Likes
794 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor

Hi @fridtjofZM5ME.  I don't think I have ever seen a button like that.  And the only two snippets of code I have come across that are similar sounding are the two lines below.

 

ThisApplication.CommandManager.ClearPrivateEvents

 

That line above says it "Clears the contents of Autodesk Inventor's internal clipboard."

 

Then the following line of code, executes a command that is supposed to 'free iLogic memory'.

 

ThisApplication.CommandManager.ControlDefinitions.Item("iLogic.FreeILogicMemory").Execute

 

I honestly do not know if either of these will help you any with your current needs though.

 

PS.  Here is also a similar command ("iLogic.ClearCodeClipboard") for clearing iLogic's code clipboard, even though this one seems a bit off topic.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 6

fridtjofZM5ME
Collaborator
Collaborator

@WCrihfieldI suppose I'll just take a stab at it an see if it works. I was sort of looking for that last one. There is actually a button called "Free iLogic Memory", but I've only seen it on the iLogic tile within the *.inest context, but I'll give it a go.

 

Not entirely cleaning out stuff you're done with from the memory is an inherit problem in Windows, and it has been that way for over 30 years now, so I'm actually not entirely sure Inventor is at fault here. Things didn't start to go south here until I set out to automate what I can of file management tasks. Might have something to do with Windows keeping files in memory even after they are closed in the Inventor context, so that when Inventor tries to overwrite those files, Windows throws an exeption back at it, or something like that. I've also noticed that when repeatedly opening/closing (or program chrash/reopen) Inventor, Vault suddenly complains about more than one session of Inventor running.

0 Likes
Message 4 of 6

grahov
Participant
Participant

Hi. did you manage to find a solution to this problem?

0 Likes
Message 5 of 6

WCrihfield
Mentor
Mentor

Hi @grahov.  A couple of other tools you may be able to use are the Document.ReleaseReference method, and the ThisApplication.Documents.CloseAll(True) method.  When you open documents invisibly (Visible = False), and those documents are not being referenced by any currently open assembly or drawing, then you can use the Document.ReleaseReference on that document, instead of the Document.Close method.  Because the Document.Close method can leave documents open in the background, and just change them from visible to not visible, if they are still being referenced by other stuff.  Then, after you used the ReleaseReference method, you can use the Documents.CloseAll(True) method, where True means that it will only clean out all of the currently unreferenced documents being held in memory.  This can help a lot when batch processing a lot of files in a loop.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 6 of 6

Frederick_Law
Mentor
Mentor

@fridtjofZM5ME wrote:

Not entirely cleaning out stuff you're done with from the memory is an inherit problem in Windows


More like programmer didn't release memory or close opened file before program end.

Also not enough error checking: is file available, readonly, file exist, variable not null etc.

 

Windows don't keep files open.

Inventor cache a few.

Another thing is files on network or cloud.  Both add delay to read write open close.

When cloud see a file is changed, it'll start a sync which will lock the file until sync is finish.

 

I'm just blindly guessing what the problem is without any code.

 

Add some Logger.Info to see what's going on and where the code stopped.

You can even us VS debugger for iLogic.  Break and stop the program and check variables.