JS File object, clearing a file by setting eof to 0. What happens to the memory?

dailytlj's icon

Hi all,
I'm using js to log from the max console to an external text file.
It's working well, and I even have it starting a new file when the file exceeds a certain size.
When this happens, it copies the contents of the log to a new file with a timestamp in the filename,
and then clears the original log file, and starts writing to it again.
I haven't found a delete or clear funtionality, so I am setting the end of file to 0 (ie file.eof=0).
This does the job of making the file blank when I check it with a text editor. Is there anything wrong with doing it this way? What happens to the memory that was occupied by the file contents? Is it immediately freed when i close the file with file.close() ?

thanks