Pages: [1] 2   Go Down
Author Topic: Hundreds of temporary files left behind  (Read 1973 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Belgium
Offline Offline
Edison Member
*
Karma: 58
Posts: 1729
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

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 -

Colorado
Offline Offline
Edison Member
*
Karma: 47
Posts: 1562
Reviving dead brain cells with Arduinos.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8903
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-sad

John.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 173
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Colorado
Offline Offline
Edison Member
*
Karma: 47
Posts: 1562
Reviving dead brain cells with Arduinos.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8903
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.  
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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.
« Last Edit: December 29, 2011, 04:31:02 am by vwlowen » Logged

Wisconsin-USA
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
God Member
*****
Karma: 24
Posts: 586
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I submitted a patch for this a couple months ago.

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

Logged

Pages: [1] 2   Go Up
Jump to: