- Run Blender with -d debug flag.
- Open this file , exit Blender
- Error: Not freed memory blocks: 26, total unfreed memory 0.002777 MB
- Loading the file multiple times increase the number of leaks on exit.
- Mentioned In
- rB20b94257dc31: Fix part of T76544: dyntopo sculpt undo stack memory leak
T76858: Threading issue in sculpt mode
- Mentioned Here
- T76858: Threading issue in sculpt mode
rB20b94257dc31: Fix part of T76544: dyntopo sculpt undo stack memory leak
P1394 Disable PBVH Threading
rB18f833be2986: Additional fix for T76426: Mantaflow Liquid - Gravity not respecting Time Scale…
P1376 (An Untitled Masterwork)
I tried to debug this for quite some time today, but I could not track down the root issue yet... I made some observations along the way though.
It's almost certainly a threading issue. I got many different outputs from asan. Furthermore, it's probably not only one issue, but multiple.
- Open file.
- Start making brush strokes. Usually, it only takes one or two brush strokes to crash when ASAN is enabled.
SCULPT_pbvh_calc_area_normal causes a warning: member call on address 0x613000adefc0 which does not point to an object of type 'task'. It does not seem to have a big impact, but it still feels like there is something wrong with the way parallel_reduce is used in BKE_pbvh_parallel_range.
Applying P1394 seems to fix all the issues for me. It disables threading in various locations. The patch also disables an unrelated assert, that should not be harmful. Enabling threading only on a single one of those, causes crashes. Depending on which one you enable, the crash looks is different. When more are enabled, it seems to be mostly a matter of luck which function fails first.
I tried to find some shared data that is not properly locked, but could not find any yet. I managed to get it working when I locked smaller code segments in the callbacks, but did not really win any significant insights from that.
This sounds like multiple bugs in a single report? There's many different steps to redo and symptoms here.
The first issue is, does any of this happen in Blender in 2.83? If so, this should probably be a high priority bug. If not, it may be TBB related.
Further, git bisect might help pin down the cause?
Regarding the various issues reported here:
- Dyntopo memory leak reported by @Ankit Meel (ankitm): fixed with rB20b94257dc31.
- Original memory leak in description: unable to reproduce. Assuming this has already been fixed. If it still happens, @Campbell Barton (campbellbarton) should run Blender with --debug-memory and specify the revision tested.
- GPU draw buffers user after free. Given the asan logs, assuming the issue found by @Sergey Sharybin (sergey) and @Jacques Lucke (JacquesLucke) is the same, and to be handled in T76858: Threading issue in sculpt mode.
- Memory leak reported by @Bohdan Lvov (ostapblender): this would be a bug in an add-on using the bgl module. If that's an add-on shipped with Blender, a bug can be reported for that add-on.