NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Increase of memory usage by using loops with huge iterations

I'm working on a monitoring tool for a field bus system, that should run 24 hours a day. I generate a timestamp when a component is used. I do this by using loops with large iterations which make an entry to database (up to 100 entries per second). The database is a Microsoft.Jet.OLEDB.4.0 (Access2000) which is opened in Setup and closed in Cleanup for only one time.
At first I had an increase of memory usage of 500 kBytes per second, then I followed the advises of KnowledgeBase article 2DB7OMVW and disabled recording of results at the sequence properties by disabling result recording for all steps. Now I still have an increase of 5 MBytes per hour.
All my Dll-functions are written in C or C++ with new and delet
e operators for memory management.
When I load Dlls dynamically for each step I get in time troubles but I think my functions of Dlls are not the problem.

I hope you can help me to solve my problem. Thank you.
0 Kudos
Message 1 of 2
(5,607 Views)
If you are constantly adding data to an Access Database, the database is opened in process and the Access Jet engine will use a cache of memory based on the size of your physical memory.

Microsoft Jet allocates memory on an "as- needed" basis up to an internally calculated high water mark. The idea is to efficiently use the memory in large RAM systems without the need to adjust Registry Settings.

The high water mark (MaxBufferSize) for Jet is calculated by the following formula:

( (((Total Ram in MB - 12)/4 ) * 1024) + 512 ) KB

For example, for a system with 32 MB RAM, Jet uses a calculated MaxBufferSize of 5,632 KB. You can override this value by setting the MaxBufferSize value in the following HKEY_LOCAL_MACHINE subtree:

\SOFTWARE\Microso
ft\Jet\x.x\Engines\Jet

For Jet 4.0, the registry location for MaxBufferSize is:
\SOFTWARE\Microsoft\Jet\4.0\Engines\Jet 4.0

You may try to see what happens if you do not write any new recores to Access at all. See if you get an increase.

You may consider changing this value from zero to 0x200 (512KB) which should limit Access and allow you to see if any memory outside of Access is being lost.

Scott Richardson (NI)
Scott Richardson
https://testeract.com
0 Kudos
Message 2 of 2
(5,607 Views)