burt4munger Posted September 19, 2019 Share Posted September 19, 2019 A windows 10 computer I have running two large DAQFactory programs is crashing in about a week due to memory running out and windows crashing (the bluescreen says) The only real applications running are two very large DAQFactory programs (and SQL Server which is known to be a memory hog but i don't think it crashes windows). I suspect the issue is likely something I'm doing, like a db.open without a matching db.close in a fast loop somewhere so I'm already looking for those. Are there any hints where to look or tools built in that might help with this? Has anyone seen issues continuously writing large amounts of debug text to the command window? I looked elsewhere in the forum and there was only one pretty dated article dealing with memory issues. Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted September 24, 2019 Share Posted September 24, 2019 If you are opening a database but never closing it, you will leak memory. It will be a pretty slow leak, but after a week could use up all available memory. Windows responds to complete loss of memory in weird ways, and a bluescreen is not unheard of. Personally I don't close my databases. I open them at startup and just leave them open while DAQFactory is running. DAQFactory will close it automatically when it shuts down. File handles often have to be closed to force Windows to clear the write cache, or to allow other applications write access to the file, but databases do not have this issue. If you are seeing that the database appears to not be updating in another program while DAQFactory is working with it, it may be that the database is transactional and you need to perform a commit on the database. The SQL command for this varies on the database, but for, say, Firebird, the command is just "Commit". Quote Link to comment Share on other sites More sharing options...
bms Posted September 6, 2021 Share Posted September 6, 2021 I'm trying to track down what I think is a memory leak. DF runs fine for about a day, then starts to error out that it can't run any sequences. Task Manager shows DF is using over 1GB of memory; up from about 150mb on startup. It looks to be an issue with my logging function, which is called every 10 seconds to write all tags to MySQL. Simplified version: try private MySQLHandle = DB.Open("dfsqlsource", "user", "pass") //for loops to create query, removed here for brevity private string SQLQuery = "INSERT INTO etc etc" DB.Execute(MySQLHandle, SQLQuery) DB.Close(MySQLHandle) catch() System.ErrorMessage("SQL Log All Error: " + strLastError) DB.Close(MySQLHandle) endcatch Am I using DB.Open() and DB.Close() correctly? Or is it something to do with the private variables staying in scope between function calls or something weird like that? Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted September 7, 2021 Share Posted September 7, 2021 I wouldn't close the db. I'd open it once at startup and just leave it open. DAQFactory will close it when it quits. Quote Link to comment Share on other sites More sharing options...
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.
Note: Your post will require moderator approval before it will be visible.