I'm writing a script that imports an FBX with an animation, and exports frames of the animation as OBJ files. However, I noticed that regardless of how I delete my objects, Blender's memory usage increases every time I run the script. I looked at the memory statistics and this is what I got:
total memory len: 299.712 MB
peak memory len: 301.169 MB
slop memory len: 11.298 MB
ITEMS TOTAL-MiB AVERAGE-KiB TYPE
1203 ( 146.366 124.588) Chunk buffer
45252 ( 145.037 3.282) Data from AC
1109 ( 2.189 2.022) BLI_Mempool Chunk
4633 ( 1.128 0.249) PropertyRNA
3151 ( 0.601 0.195) StructRNA
1 ( 0.532 544.750) TaskScheduler task threads
3417 ( 0.417 0.125) IDProperty array dup
2542 ( 0.371 0.149) dupli_mapalloc
1987 ( 0.349 0.180) keymap entry
1888 ( 0.346 0.188) operatortype
2017 ( 0.246 0.125) IDProperty group
I understand that "Chunk buffer" refers to the memory used by the Undo function, but what is "Data from AC"? This is the memory usage just after opening the file, and there are currently no objects in the scene.
EDIT: Here is my delete function:
def clearScene():
for i in range(20):
bpy.data.scenes['Scene'].layers[i] = True
print("All layers selected")
bpy.ops.object.select_all(action='SELECT')
print("All objects selected")
bpy.ops.object.delete(use_global=True)
print("All objects deleted")
bpy_data = [bpy.data.actions,
bpy.data.armatures,
bpy.data.brushes,
bpy.data.cache_files,
bpy.data.cameras,
bpy.data.curves,
bpy.data.fonts,
bpy.data.grease_pencil,
bpy.data.groups,
bpy.data.images,
bpy.data.lamps,
bpy.data.lattices,
bpy.data.libraries,
bpy.data.linestyles,
bpy.data.masks,
bpy.data.materials,
bpy.data.meshes,
bpy.data.metaballs,
bpy.data.movieclips,
bpy.data.node_groups,
bpy.data.objects,
bpy.data.paint_curves,
bpy.data.palettes,
bpy.data.particles,
bpy.data.rna_type,
bpy.data.scenes,
bpy.data.screens,
bpy.data.shape_keys,
bpy.data.sounds,
bpy.data.speakers,
bpy.data.texts,
bpy.data.textures,
bpy.data.worlds]
for bpy_data_iter in bpy_data:
for data in bpy_data_iter:
bpy_data_iter.remove(data)
I realized an error in my delete function, but now with these last three lines, I get an error saying the BlendData data type is not iterable. Is there a better way to remove all data?
readfile.c) and it appears to be action data. (bpy.data.actions) AR for armature etc. Are you removing actions? – batFINGER May 28 '18 at 15:29bpy.ops.objects.deleteremovng from bpy.data.objects will do that. – batFINGER May 28 '18 at 15:46