Go Down

Topic: Hundreds of temporary files left behind (Read 2622 times) previous topic - next topic

vwlowen

Hi,

I've only recently started with the Arduino, so only recently installed the IDE version 1.0.   For an unrelated reason, I was looking in my computer folder c:\users\<xxx>\AppData\Local\Temp\  and, in there, were over 760 folders related to Arduino, each containing a short text file.

It seems that every time the IDE is opened - whether a sketch is loaded or not - the IDE creates three temporary files but only deletes one of them when the IDE is closed.

Is this a bug or have I misconfigured something?  I can't believe that the IDE is supposed to leave its temporay files behind.

Thanks,

John.

Nick Gammon

The Temp folder is supposed to hold temporary files. When do you want them deleted?

By definition, they are temporary.

Better check out your Internet browser cache folder, I bet there are a whole lot more files there.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

vwlowen

I understand what you're saying but my Browser has a drop-down menu item which allows me to clear the cache/recent history and, in any event,  there's a logical reason why it's desirable for a browser to cache its recent files.

It shouldn't be necessary for a user to navigate "manually" to an obscure folder that nobody ever visits.  When an application creates temporary files and folders for its own use, personally, I would expect the application to do its own housekeeping. By definition, temporary should be temporary. To answer your question as to when do I want them deleted, that should be a configurable option in the IDE preferences: Immediately when the IDE closes, after xx Days, after 1MB etc.

John.


Jantje

Hi
I checked on my system and there are indeed plenty of files in the temp folder for each run. It is unacceptable to leave so many temp files and even ore unacceptable so many folders.

The idea about temporary folder is that a can separate between core files (written in the installation folder or the my documents folder) and temporary files (written in the temp folder). As a user you can delete the files in the temp folder without risk of deleting crucial system files or personal data.
This is for instance handy when a program crashes and therefore was unable to delete the temporary files. It is however implied that a program writing in the temp folder cleans his files as much as possible. I think leaving 1 folder after each run is unacceptable.

The comparison with the browser is not correct because the browser will read the temporary files during later runs. Most browsers also have a "disk limit parameter" allowing to configure how much disk can be used. So it will never eat all your disk space. It also uses only one folder.

When to clean up? Wen you do not need it anymore. For instance when you close the sketch or when you close the last IDE window.


Best regards
Jantje

PS: having plenty of folders in the temp drive slows down the windows operating system. (I have no experiance with other operating systems but as far as I understand it is a hardware constraint and other OS's will suffer this as well)
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

KirAsh4

Plenty of applications will create temporary files when they are launched and used.  However, they also know to delete them when you exit the application.  The Arduino IDE seems to be the only one that's dumb founded in that respect.  0 byte files get created and are never deleted.  This does, after a while, clog up the temp folder, and ultimately will affect the OS itself.

By definition, temp files are exactly that, temporary.  However, by Arduino "standards", they are permanent since they're never deleted.  I call this bad coding practices.  If you write an application that's creating temp files, you should also do your housekeeping and clean them up after the application is closed.  Or at the very least, give the end user tools to manage the temp files, just like any browser does.

I've made it a habit to delete everything in my temp folder every week or two, thanks to using the IDE almost on a daily basis.  It's ridiculous.

By the way, vwlowen, a quicker way to get to your temp folder next time is to click Start -> Run and type in '%temp%' without the quotes.  Quick access.

zoomkat

I guess the question now is which temp files are associated with the arduino. There seem to be more than one type. Time to make a batch file to DEL jna*.tmp and similar.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

vwlowen

Mine leaves behind folders named untitled123....4567.tmp  in which is another folder, in which is  sketch_<date> .ino file.

It also leaves behind folders named console123...4567.tmp in which are two files stderr.txt and stdout.txt - which may or may not actually contain text.

The third file is named jna1234....567.tmp (no folder) but that one is deleted when the IDE is closed.
.. And another folder named build1234....567.tmp which is also deleted when the IDE is closed.

I've had a quick go at writing a batch file but it needs to RemoveDirectories which are not empty (console*.tmp and untitled*.tmp) and I've long forgotten my DOS command line skills :(

John.

Nick Gammon

On my Mac I found a quite a few temporary files lying around, but not all that many seemed to be related to the Arduino.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

cappy2112


Hi,

I've only recently started with the Arduino, so only recently installed the IDE version 1.0.   For an unrelated reason, I was looking in my computer folder c:\users\<xxx>\AppData\Local\Temp\  and, in there, were over 760 folders related to Arduino, each containing a short text file.

It seems that every time the IDE is opened - whether a sketch is loaded or not - the IDE creates three temporary files but only deletes one of them when the IDE is closed.

Is this a bug or have I misconfigured something?  I can't believe that the IDE is supposed to leave its temporay files behind.



Thanks,

John.


Every time you compile, the ide copies your sources into a unique temporary directory, and compiles them there.
I don't know how often it creates the unique directory- if it is once per day, or once per running session of the ide.

KirAsh4


I guess the question now is which temp files are associated with the arduino. There seem to be more than one type. Time to make a batch file to DEL jna*.tmp and similar.

On Windows, as long as you don't have any applications open, you can delete all of them.  Those that are still open in a process will cause an access error and you can just skip that file.  When I empty my temp folder, only 2 files remain, and both of them are tied to windows processes.

zoomkat

Quote
The third file is named jna1234....567.tmp (no folder) but that one is deleted when the IDE is closed.


I had 400+ of these files at 300k each (and probably the same number of the others, console, build, and untitled). I have to kill the arduino IDE (javaw.exe) when it is non responsive using task manager, which may be why so many files are orphaned.  
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

vwlowen



Every time you compile, the ide copies your sources into a unique temporary directory, and compiles them there.
I don't know how often it creates the unique directory- if it is once per day, or once per running session of the ide.



It actually creates four unique directories and only deletes one of them.

As soon as you open the IDE, three folders are created:  console<unique_number1>.tmp, untitled<unique_number2>.tmp and build<unique_number3>.tmp. 

console<unique_number1>.tmp contains two files: stderr.txt and stdout.txt

untitled<unique_number2>.tmp contains a sub-folder: sketch_<date> which contains, at that point, contains a 0-byte file: sketch_<date>.ino

Also created directly in the %Temp% folder is a file: jna<unique_number4>.tmp which, at this stage is 300KB in size.

It doesn't matter how many 'sibling' windows are opened from the the IDE, no more folders or files are created.  If you load a sketch, nothing new happens until you compile it. Then a temporary <unique_number5>.s file is created that is deleted atomatically as soon as the compile ends.

When you close the last IDE window, the file: jna<unique_number4>.tmp and build<unique_number3>.tmp are both deleted.  But console<unique_number1>.tmp,  untitled<unique_number2>.tmp, sketch_<date> and  sketch_<date>.ino all remain.

So, basically,  3 unique folders and 3 unique files are permanently created every time the IDE is opened and closed.

John.

vwlowen

#12
Dec 29, 2011, 10:21 am Last Edit: Dec 29, 2011, 10:31 am by vwlowen Reason: 1
Sorry to follow my own post but, if anyone is interested, I've written a little batch file. I'll leave it on the desktop alongside the Arduino shortcut.  [Use at your own risk!]

Code: [Select]

rem Arduino-cleanup.bat
rem ===================

rem Clean up temporary Arduino files & folders.
rem First change directory to location
rem of temporary folders...

cd c:\users\john\appdata\local\temp

for /d %%a in (console*.tmp) do rmdir /s /q %%a
for /d %%a in (untitled*.tmp) do rmdir /s /q %%a




John.

stef


Sorry to follow my own post but, if anyone is interested, I've written a little batch file. I'll leave it on the desktop alongside the Arduino shortcut.  [Use at your own risk!]


John.



John,

Works great!  Thank you.

-stef

Paul Stoffregen

I submitted a patch for this a couple months ago.

http://code.google.com/p/arduino/issues/detail?id=701


Go Up