DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

memoryconsumption - ASAM-ODS - AOP5 (Speicherproblem)

Solved!
Go to solution

for german txt please read below...

**** 

Hi @ all,

 

 I got a problem with memoryconsumption in code like the following:

 

[...] 

Call OdsValAlloc("VehicleList", "Ods_TYPE_INST", 1)

Call OdsInstList("Vehicle","State = 1","VehicleList", OdsHandle)

intAnzahlVehicle = OdsValCount

 

 

For intI = 1 To intAnzahlVehicle

    '***** Anzahl der Configs ermitteln

   Call OdsValuesCount(VehicleList(intI), "Configurations", OdsHandle)

   intAnzConfigs = OdsValCount

   '***** Instanz mit den entsprechenden "Configurations"

   Call OdsValAlloc("ConfigList", "Ods_TYPE_INST", 1)

   Call OdsValGet(VehicleList(intI),"Configurations", 1, intAnzConfigs, "ODS_TYPE_INST", "ConfigList", 1, OdsHandle)

 

    For intJ = 1 To intAnzConfigs

         [...]

    Next

    Call OdsValFree("ConfigList")

Next

Call OdsValFree("VehicleList")

[...]

 

 

I itterate through several instancelists, which I get from our ASAM-ODS-database. Several informations like in this code 'vehiclename' or 'configurationsnumber' are stored in variants and writen in a txtfile.

Several trys with a shortend script in with I only itterates through the instances shows the same behaviour.

 

I only GET information from the database.

 

After a while all my memory is in use and the script chrash.

Unfortunately it seems that the command 'OdsValFree' didn't release the used memory of the GPI-variables.

If I close the connection to the server ('OdsClose') then the memory will be accesible again.

 

Any hints out there?

Thx

Contur

 

****************************************

German:

Hi zusammen,

 

ich habe in mehreren Scripten, die wie das Obige aufgebaut sind, das Problem, dass DIAdem immer mehr Speicher belegt und das Script nach einer weile mit ner Speicherfehlermeldung abstürzt.

Beim Itterieren durch diverse Instanzen, welche ich aus unserer ASAM-ODS-Datenbank lese, wird immer mehr Speicher verbraucht, auch wenn ich - wie im Script angegeben - die GPI-Variablen freigebe.

 

Ich habe den Code schon soweit gekürzt, dass ich nur durch die Instanzen itteriere und nichts weiter in irgendwelcher Form vorhalte. Problem existiert weiterhin.

Wenn ich mit 'OdsClose' die Verbindung zur DB beende, wird der Speicher freigegeben. Allerdings benötige ich manche Instanzen ja zum Itterieren....

Ich habe in diesem Fall nur lesenden Zugriff auf die Datenbank.

 

Danke für's lesen 😉

Contur

0 Kudos
Message 1 of 4
(4,153 Views)
Solution
Accepted by Contur

Hmm, aktually the plugin behaves like this.

All information retrieved by the server is cashed till

 

  • OdsDialogRefresh handle
  • OdsClose handle

 

is called. This behavior is done to allow performant access to the server retrieved data.

I a m wondering a little bit that even iterating over instances will cause this huge memory consumtion.

 

Do your entities have thaosands of attributes? Or are you just handling a huge amount of instances.

Please keep in mind that an ASAM Ods server normally does not return more than 10000 instances.

 

 

Workarounds:

OdsDialogRefresh will not release the complete memory but should be a good first step and helps in most cases.

OdsClose will help globably as you already determinde. The whole thing isn't that worse. There are two ways to do the job.

 

To be known: The odskeys returned by odsinstlist, odsvalget, odssvalget are persistent. So they can be used even if the session is closed. Even the day after.

  1. Close the sourec sometime and go on working with the source after reopened it.
  2. Use a second opened store and use the keys retrieved by source1 in source2. So you can open and close source2 some times.

Both solutions work quiet well with AOP, AOP5, ATF, ATFX.

 

Hope this helps

Greetings Andreas

 

P.S.: To speed up work with AOP5 it is possible to specify Instances that should not be removed from cache in the advanced settings. Canidate for this is stuff like unit or quantity that else has to be retrieved from server every time it is requested. So if if you are working on a lot of sets having the same unit, quantity this may help. Else the unit and quantities can be resolved from a second source which isn't refreshed or closed.

 

0 Kudos
Message 2 of 4
(4,151 Views)

Hi Andreas,

 

thx 4 your response.

 

I've tried the 'OdsDialogRefresh handle', but I still got the same problem.

 

Now I closes the connection and reopen it - this works fine. THX

 

 

But I still have a question:

- why does the 'OdsValFree' statement doesn't have 'n effect relating to the memory consumption?

   I want a little bit of information from a database, save it or work with it and then I want to throw it away. But how?

 

 

By the way: my entities doesn't have a lot of attributes, but I have to handle a lot of instances...

 

Thx for the very fast reply.

Contur

0 Kudos
Message 3 of 4
(4,142 Views)

Hmm, OdsValAlloc and OdsValFree is a window into the past.

 

Once upon a time there was DIAdem 7. It didn't use vbscript and it did just have some variables like R1, ..

There was no dynamic part.

 

No dynamic. No that's wrong. There was OdsAlloc and OdsFree which was bale to create variables and lists.

 

🙂

 

So this is really a relict from old time which is still reflected in the ODS API.

 

OdsValAlloc "doubleVar", "ODS_TYPE_DOUBLE" , 10

 

in a language like C would be

 

double doubleVar[] = new double [10];

 

and

 

OdsValFree "doubleVar"

 

would match

 

delete [] doubleVar;

 

So in new vbs syntax it would match

 

dim doubleVar[]

resize(doubleVar, 10)

 

so it is not related to any Server specific stuff but only allows to create a string, double, vector, ...

 

Greetings from sunny Aachen

Andreas

 

0 Kudos
Message 4 of 4
(4,134 Views)