1
$\begingroup$

When I toggle the panel checkbox created by the following code the memory usage count in the info bar starts to climb at an alarming rate. Any idea why this is happening?

import bpy


class HelloWorldPanel(bpy.types.Panel):
    """Creates a Panel in the View3D UI panel"""
    bl_label = "Mesh Stats"
    bl_idname = "MESHSTATS_PT_hello"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'

    def draw(self, context):
        layout = self.layout
        row = layout.row()
        row.prop(context.scene, "my_prop")


def register():
    bpy.types.Scene.my_prop = bpy.props.BoolProperty(name="Prop name", description="Some tooltip", default=True)
    bpy.utils.register_class(HelloWorldPanel)

def unregister():
    bpy.utils.unregister_class(HelloWorldPanel)

if __name__ == "__main__":
    register()
$\endgroup$
5
  • $\begingroup$ What is an alarming rate for you? You don't know what Blender does in the background to load the addon. Can you provide more data. $\endgroup$ Sep 15, 2015 at 19:00
  • $\begingroup$ Memory usage is at about 9M when the panel is loaded and climbs to about 18M after clicking the checkbox a dozen or so times - increasing after each click. Thats almost double the original memory usage. It seems to stop increasing after that level is reached. $\endgroup$ Sep 15, 2015 at 19:07
  • $\begingroup$ okay so apparently this has something to do with the undo stack. its expected behaviour. $\endgroup$ Sep 15, 2015 at 19:36
  • $\begingroup$ Ok, very well Where did you find this information that it's expected behavior? Please answer your question yourself and mark the answer as the correct one. $\endgroup$ Sep 16, 2015 at 5:26
  • $\begingroup$ I spoke to one of the developers on the #blendercoders irc channel who said that this was due to the undo stack allocating memory. $\endgroup$ Sep 18, 2015 at 15:28

1 Answer 1

2
$\begingroup$

Blender allocates memory for the undo stack when you perform undo-able actions. There is a limit to this allocation determined by the number of undo steps you have specified. See "User Preferences->Editing->Undo->Steps".

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .