The temp directory (by default located in Confluence Installation Directory) is configured in the Java runtime and some Confluence components write temporary files or lockfiles into this directory. (reference)
Basically, this directory is required during runtime and it gets larger over time.
By having the configuration implemented, it would be great if Confluence can automatically clear the content of this directory every time the instance is shut down. This feature would make system maintenance job easier.