Free Idea Internal Resources

10 posts / 0 new
Last post
avikerem's picture
avikerem
Offline
Joined: 04/07/2015 - 00:28
Free Idea Internal Resources

hi Brian
I have a program that creates some databases and delete them while the script is running, the script loops few hundred times until it finishes.
somewhere along the execution path the script crashes, in different places, with Idea internal error message. The reason I think it is resources not freed correctly issue is because when I restart the PC I can progress from a saved point to the next crash and so on until the script reaches not so safely the promised land.
 
I am searchiing of course where exactly I forgot to set an object to Nothing or something similar, But until I find the bug, is there a way to clear all Idea resources so the next round will not require a complete PC restrt
 
Thanks a lot and have a wonderful day
Avi Kerem

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Avi,

Actually just last week I had somone with a similar problem and it turned out that there were variables defined on the same line such as:

Dim i, j as integer

In theory this should work but there is a bug in IDEAScript where only the last variable is defined properly.  If you have anything like this make sure you only have one variable per line:

Dim i as integer

Dim j as integer

Once I made the change everything worked fine.  In their case they were looping through all the fields of a large file and it would crash around field 400 but then you could start it up and it would continue with the rest so it sounds similar to your problem.

avikerem's picture
avikerem
Offline
Joined: 04/07/2015 - 00:28

Thanks for your answer Brian
I am specuating that this is a case of databases being overwritten and not deleted first.
In order not to overflood the system after few hundreds loops' I simply overwrite those previous loop generated databases which are not needed anymore by using the same names in the next loop
I am going to try this theory by explicitely DeleteDatabase() instruction before  using the same name again
I hope it will solve the problem
Have a great day
Avi Kerem
 

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Let me know how it turns out.  You also have a good day.

Brian

avikerem's picture
avikerem
Offline
Joined: 04/07/2015 - 00:28

It did not help.
It will take me a few days to transfer the whole project to another laptop and try my script with that local idea installation to determine if I need to reinstall Idea in the original laptop or if this a genuine  bug after all

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

You are having an interesting problem.  Hopefully you can get it worked out.

avikerem's picture
avikerem
Offline
Joined: 04/07/2015 - 00:28

A Brief History of Ideakind
After I got a shiny new, never used before, clean and fresh installation of Idea version 10 and Idea was still happily crashing as before, I decided to look seriously into the problem.
First, I noticed that the first crash is not random at all, it occurs exactly at round 64 of the loop
Still looking for exhausted Idea resources I decided to question my assumption that at every round of the loop all databases are new (IE without any recollection of their gruesome past history) either because they were deleted explicitly or because they have been overwritten
I found that the following code does not work as I expected
1         Set task = Client.ProjectManagement
2         task.DeleteDatabase "ResultsDB" & ".IMD"
3         Set task = Nothing
4         client.CloseAll
5        Set task = Client.ProjectManagement
6         task.RenameDatabase "UpdatedResultsDB" & ".IMD", "ResultsDB" & ".IMD"
7         Set task = Nothing
One may think that in line 2 of the above code the history of "ResultDB" database is removed when
the database is removed
If you think that this is the case you may be surprised to learn that
When the code crashes at round 64, the history of the ResultsDB database has 720 building blocks (a building block is elementary script function such as join, summarize, extract, new field,
 New/modify/remove field, etc.)
The timestamp of these elements shows that they survive all generations of
ResultsDB database even after they have been removed and another database proudly inherited their name.
Well - this may be a known well documented and perfectly explainablefeature of Idea - but then my original question is how can I really remove databases and safely reuse their name without having to carry their previous lives history.
Again - There may be no bug at all, just a question on reuse of database names.
 
Kind Regards,
Avi Kerem

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Avi,

Any chance you can share the script with me.  This sounds like a bug and I wouldn't mind having the support team look at this further to see if it is something the developers should look at.

Thanks

Brian

avikerem's picture
avikerem
Offline
Joined: 04/07/2015 - 00:28

With pleasure
Since this is a script for computing moving average I will just organize it a bit and I will trim considerably the size of the single input database requires by the script on day 0
the loop is set for 100 rounds (in the i-th round the script computes for each stock item the moving average for day i)
in my case the script crashes when i = 64 and each relevant databases history size at that point is 720
 
Thanks a lot Brian for your help!
Avi Kerem

b7shobhit
Offline
Joined: 07/25/2020 - 19:37

Dear Avi,

Greetings for the day.

We are also trying to develop a running average calculation for Inventory.
It will be really helpful if you could share your script as a reference. We have tried multiple iterations in our script, it fails most of the time when multiple combination of Inventory item is tested.
I possible requesting you to please mail the script at b7shobhit@gmail.com.

Regards,
Shobhit