Re: Cleaning up temporary files
Felix Saphir <[email protected]> Tue, 08 Jan 2013 15:44:05 +0100
| Newsgroups | gmane.comp.video.graphicsmagick.apis |
|---|---|
| Message-ID | <[email protected]> |
Am 07.01.2013 19:25, schrieb Bob Friesenhahn: > On Mon, 7 Jan 2013, Felix Saphir wrote: >> >> I have a bunch of programs for automated image processing. Each (main) >> program fork()'s some child processes to do the actual work. Can I just >> call DestroyMagick() before I _exit() a child to clean up temporary >> files? Or is there another way? > > Are you encountering a lot of "residue" temporary files? Ideally, > code which uses temporary files should remove those temporary files > immediately when it is done with them. Sometimes things are not ideal > such as there might be a bug in the code or some external program does > not work as expected. As a safeguard, GM's temporary file allocation > code keeps a record of all of the temporary files which are still > allocated. If you invoke DestroyMagick() just before the program > exits, then that will invoke DestroyTemporaryFiles() which will unlink > any temporary files which were not previously removed. Thank you for your reply. Problem is the main process is not supposed to exit. It just sits there and waits for something to do, forks child processes and goes back to sleep. I didn't mention that, sorry. The original developer didn't bother to call Initialize- or DestroyMagick(), that's my duty now ... Lucky for me, all the image processing stuff happens in the forks, so from your reply I guess I should just call both functions from there. Thanks again, Felix ------------------------------------------------------------------------------ Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and more. Get SQL Server skills now (including 2012) with LearnDevNow - 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only - learn more at: http://p.sf.net/sfu/learnmore_122512