Page MenuHome

T39690: Modifications to Blender's 'temp dir' system.
ClosedPublic

Authored by Bastien Montagne (mont29) on May 15 2014, 9:21 PM.

Details

Summary

Current temporary data of Blender suffers one major issue - default 'temp' dir on Windows is never
automatically cleaned up, and can end being quite big when used by Blender, especially when we have
to store per-process data (using getpid() in file names).

To address this, this patch:

  • Divides tempdir paths in two, one for 'base' temp dir (the same as previous unique tempdir path), the other is a mkdtemp-generated sub-dir, specific to each Blender instance.
  • Only uses base tempdir when we need some shallow persistance accross Blender sessions - and we always reuse the same filename (quit.blend...) or generate small file (crash reports...).
  • Uses temp sub-dir for heavy files like pointcache or renderEXRs (Save Buffer option).
  • Erases temp sub-dir on quit or crash.

To get this working it also adds a working 'recursive delete' to BLI_delete() under Windows.

Note that, as in current code, the 'recover render result' hack-feature that was possible
with SaveBuffer option is still removed. I would rather add a real render caching feature,
but this would go in another patch!

Diff Detail

Event Timeline

Only picky name comments so far.

source/blender/blenlib/intern/path_util.c
76–77

picky: find these names a bit confusing, suggest.

  • btempdir_base or just btempdir
  • btempdir_session
2382

XXXXXX - this looks wrong?

2437

picky stuff again, BLI_temporary_dir, BLI_temporary_dir_session

Try to keep BLI_prefix_... consistent.


Since there exists BLI_temporary_dir_purge which isnt a new kind of tempdir, we could have...

  • BLI_temporary_dir_base_get
  • BLI_temporary_dir_session_get
  • BLI_temporary_dir_session_purge

In interest of shorter names we could have BLI_temp_dir_... too (am not fussed).

Bastien Montagne (mont29) updated this revision to Unknown Object (????).May 21 2014, 5:39 PM

Address first review comments, and update patch against latest trunk.

Bastien Montagne (mont29) updated this revision to Unknown Object (????).May 26 2014, 7:38 PM

Updated against latest master.

Bastien Montagne (mont29) updated this revision to Unknown Object (????).Jun 16 2014, 9:37 AM

Updated against latest master.

source/blender/blenlib/intern/path_util.c
2323–2324

Add new basename argument to comment here.

2382

Can we use '#' instead of 'X' here?

Update the comment and LGTM.

source/blender/blenlib/intern/path_util.c
2382

Nevermind, this comes from mkdtemp.