Memory leaks can be difficult to track down. In your case I suspect that you are using a label printer with it's own library or driver and leaks could be anywhere.
Firstly you should try and understand what memory management models exist in the application. With C++ Builder code generally you will be responsible for allocating and freeing memory. So every object you create with new
should have a corresponding delete
- make sure you understand what part of the code is responsible for freeing the object. (In 10.3.1 C++ Builder does support C++ auto_ptr
but you may not be using this, and you can't guarantee that any library code you have linked in will honour the auto_ptr
semantics).
If you are passing information into code that's using another memory management model (so using a COM Object is a good example) then make sure you understand the implications for memory management. If you pass it a pointer is it expecting to free it or is it expecting you to free it - and if it's you how do you know when it has finished with it.
Try running a smaller run and seeing if with a smaller run you can use CodeGuard and pick up anything it suggests.
If your system is in production you will want to keep it running. One option would be to run it as a Windows Scheduled Task. It will process a set number of files and exit. The O/S will free up resources it had in use (but not any that are being leaked at the system level, perhaps by a buggy driver). That may allow you to keep it running all day while you continue to find any leaks.
Good Luck!