Re: tile ref count balance warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Basically this means that your plug-ins creates drawables and doesn't
> destroy them later nor does it attach them to any image. Of course it's
> not correct that GIMP allows plug-ins to do such things. It should clean
> up after them and release all resources they allocated. But this is not
> an ideal world and this cleanup mechanism in the core remains to be
> unimplemented. So as a plug-in developer you should be careful about
> releasing all resources you are allocating in the GIMP core.

Of course -- I wasn't expecting the GIMP to take out my trash for me, and 
I *thought* I had been careful to do so, but I'm clearly missing 
something.  I've been going through old SVN versions of my plugin, and it 
looks like the bug has been there for a long time, but Gimp 2.2.11 doesn't 
report a tile ref error.  Was there a change between 2.2 and 2.4 with 
respect to how various functions clean up, or is this likely just a change 
in reporting?

I'm mostly looking for ways to help me narrow this down -- I have ~5000 
lines of potentially-suspect code, since I was developing under 2.2.11 
until recently, and am having little luck.  I've found various snippets 
that change the likelihood of the bug occurring (mostly involving invoking 
other plugins via gimp_run_procedure), but are insufficient to reproduce 
it when used in isolation.  If there were a way to check the number of 
tiles currently allocated, I believe it would be useful in the triage 
process.

That said, I've sliced out chunks of my plug-in wholesale and run it with 
ltrace to catch all calls into the libgimp* family of libraries.  Below is 
a (short) trace of an invocation that resulted in a tile ref count error. 
The likelihood of the problem occurring is ~proportional to the number of 
iterations of the denoted loop.  Said loop is a one-for-one transcription 
of script_fu_coffee_stain (which calls a transcription of 
script_fu_distress_selection).  I'll continue to eliminate code and try to 
create a self-contained example, but if anyone sees anything obviously 
wrong, I'd appreciate any pointers.

Thanks,

-Brennan


---------------------------------------------------------------------------

gimp_main(0x82a7880, 6, 0xbff0f494, 0x82511a9, 0xb7ef8800 <unfinished ...>
   gimp_procedural_db_get_data(0x8252d23, 0x82cdbe0, 0x8252d0b, 0x835f1f8, 0x8356dc8) = 0
   gimp_procedural_db_get_data(0x8252d2c, 0x82d6c40, 0x8252d0b, 0x835f1f8, 0x8356dc8) = 0
   gimp_procedural_db_get_data(0x8252d38, 0x82dfca0, 0x8252d0b, 0x835f1f8, 0x8356dc8) = 0
   gimp_image_new(400, 410, 0, 0xb75e4ff4, 52)                                     = 1
   gimp_layer_new(1, 0x875b6f4, 400, 410, 1)                                       = 2
   gimp_image_add_layer(1, 2, -1, 410, 1)                                          = 1
   gimp_display_new(1, 2, -1, 410, 1)                                              = 1
   gimp_image_height(1, 0xbff0e0e4, 0xbff0e058, 0x820c437, 0xbff0e3b0)             = 410
   gimp_image_width(1, 0xbff0e0e4, 0xbff0e058, 0x820c437, 0xbff0e3b0)              = 400

   // Begin loop; below is repeated 20 times, with some randomized parameters
   // Start script_fu_coffee_stain transcription
   gimp_layer_new(1, 0x8269958, 400, 400, 1)                                       = 3
   gimp_image_add_layer(1, 3, 0, 400, 1)                                           = 1
   gimp_selection_all(1, 3, 0, 400, 1)                                             = 1
   gimp_edit_clear(3, 3, 0, 400, 1)                                                = 1
   gimp_ellipse_select(1, 0, 0x40666000, 0, 0x40666000)                            = 1
   // Start script_fu_distress_selection transcription
   gimp_image_width(1, 0xb7da34b0, 0xbff0e038, 0xb73ac181, 0xb74c4070)             = 400
   gimp_image_height(1, 0xb7da34b0, 0xbff0e038, 0xb73ac181, 0xb74c4070)            = 410
   gimp_image_base_type(1, 0xb7da34b0, 0xbff0e038, 0xb73ac181, 0xb74c4070)         = 0
   gimp_layer_new(1, 0x82697f3, 400, 410, 1)                                       = 4
   // Scratch layer is removed from image below
   gimp_image_add_layer(1, 4, 0, 410, 1)                                           = 1
   gimp_selection_is_empty(1, 4, 0, 410, 1)                                        = 0
   gimp_edit_fill(4, 1, 0, 410, 1)                                                 = 1
   gimp_selection_invert(1, 1, 0, 410, 1)                                          = 1
   gimp_selection_is_empty(1, 1, 0, 410, 1)                                        = 0
   gimp_edit_clear(4, 1, 0, 410, 1)                                                = 1
   gimp_selection_invert(1, 1, 0, 410, 1)                                          = 1
   gimp_selection_none(1, 1, 0, 410, 1)                                            = 1
   gimp_layer_scale(4, 100, 102, 1, 1)                                             = 1
   // plug_in_spread
   gimp_run_procedure(0x826980a, 0xbff0e020, 0, 1, 13)                             = 0x8459e88
   // plug_in_gauss_iir
   gimp_run_procedure(0x8269819, 0xbff0e020, 0, 1, 13)                             = 0x87521b0
   gimp_layer_scale(4, 400, 410, 1, 13)                                            = 1
   // plug_in_threshold_alpha
   gimp_run_procedure(0x826982b, 0xbff0e020, 0, 1, 13)                             = 0x8459f48
   // plug_in_gauss_iir
   gimp_run_procedure(0x8269819, 0xbff0e020, 0, 1, 13)                             = 0x845a050
   gimp_selection_layer_alpha(4, 0xbff0e020, 0, 1, 13)                             = 1
   // Remove scratch layer
   gimp_image_remove_layer(1, 4, 0, 1, 13)                                         = 1
   gimp_drawable_is_channel(3, 4, 0, 1, 13)                                        = 0
   // End script_fu_distress_selection transcription
   gimp_context_set_gradient(0x826995e, 1, 3, 0x4ba56359, 0x40369cb7)              = 1
   gimp_edit_blend(3, 3, 0, 8, 0)                                                  = 1
   gimp_layer_set_offsets(3, 23, -17, 8, 0)                                        = 1
   // End script_fu_coffee_stain transcription
   // End loop

   gimp_selection_none(1, 181, 188, 8, 0)                                          = 1
   gimp_procedural_db_set_data(0x8252d23, 0x82cdbe0, 36936, 0x82d6c2c, 0x82dfca0)  = 1
   gimp_procedural_db_set_data(0x8252d2c, 0x82d6c40, 36936, 0x82d6c2c, 0x82dfca0)  = 1
   gimp_procedural_db_set_data(0x8252d38, 0x82dfca0, 12288, 0x82d6c2c, 0x82dfca0)  = 1
<... gimp_main resumed> ) 
= 0
+++ exited (status 0) +++

_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux