jackv7152 Posted February 28, 2006 Report Share Posted February 28, 2006 I have finished a software with the labsql,but when the software runs ,the used momory becomes bigger an bigger.at the begining ,memory is 41M,serveral hours later,it is over110M :question: thank you Quote Link to comment
didierj Posted February 28, 2006 Report Share Posted February 28, 2006 I have finished a software with the labsql,but when the software runs ,the used momory becomes bigger an bigger.at the begining ,memory is 41M,serveral hours later,it is over110M :question: thank you Quite hard to give any advice, since there is not too much info. From what you said, it seems to me, that you open references to the sql-objects, but not close them. Check that every single call to "open reference" is followed (after the work on this reference is done) by a call to "close reference". Didier Quote Link to comment
i2dx Posted February 28, 2006 Report Share Posted February 28, 2006 sounds like a "memory leak" ... make sure, that you free the memory with the adequate function after sending e.g. a SELECT query! Quote Link to comment
jackv7152 Posted March 1, 2006 Author Report Share Posted March 1, 2006 i close the database everytime .how can i free the memory? another condition :the used memory change little when operateing ActiveX(Access) operate database .why? Quote Link to comment
Dave Graybeal Posted March 1, 2006 Report Share Posted March 1, 2006 There are many things that can contribute to memory issues. The following is a list of common mistakes I have made in the past that can add to the bulkyness of code: 1) Look for the use of the Build Array function within a loop. If I remember Correctly this causes an additional copy of the array to be created each execution of the loop. This can be solved by initializing the array outside of the loop and using the insert into array function within it. The concatenate string functions works in a similar way to the build array as well. 2) Watch out for the use of Local and Global Variables. Local Variables cause a front panel to remain in memory even after the VI's execution has ended ( so sub vi's that use these in the background will stay in memory). Global Variables will create an additional copy of the data each time that the Global Variable appears in the code. 3) Clusters that contain clusters can also be an issue, because as you unbundle the data it will create additional copies in memory instead of referencing the original data. Hopefully some of this information is as helpful to you as it was for me. Good Luck, Dave Graybeal Quote Link to comment
i2dx Posted March 1, 2006 Report Share Posted March 1, 2006 i close the database everytime .how can i free the memory?another condition :the used memory change little when operateing ActiveX(Access) operate database .why? i have to admit, i am not a user of LabSQL, but as far as i know, it uses ADO / ActiveX. Somewhere in the palettes there has to be a function which does the following: the 2D Array of Variant is sored somewhere in the memory of your computer. LabVIEW gets the pointer to this region. If you send a select query without closing that pointer (=freeing the memory) the pointer holds an address of a new memory segment and the old segment is "lost", but the memory is still marked as "used" and is unavailiabe for other applications. with every new sql query, that does not free the memory after taking the data into your programm, the ammount of used memory is increasing maybe someone with deeper knowledge of LabSQL can help you out, finding the appropriate VI? Quote Link to comment
jackv7152 Posted March 2, 2006 Author Report Share Posted March 2, 2006 I feel i have know much though your ideas,Thank you very much. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.