From: <di...@us...> - 2018-11-28 14:14:31
|
Revision: 3734 http://sourceforge.net/p/ftm/code/3734 Author: diemo Date: 2018-11-28 14:14:28 +0000 (Wed, 28 Nov 2018) Log Message: ----------- avoid runaway memory by doint jfont_destroy after every jfont_create, start hunting down runaway CPU from ftmobj_fit_to_text called in a loop via defer_low in ftmobj_set_attribute_patching_size Modified Paths: -------------- trunk/ftm/externals/max5/ftm.object.c Modified: trunk/ftm/externals/max5/ftm.object.c =================================================================== --- trunk/ftm/externals/max5/ftm.object.c 2018-05-23 14:18:31 UTC (rev 3733) +++ trunk/ftm/externals/max5/ftm.object.c 2018-11-28 14:14:28 UTC (rev 3734) @@ -1,3 +1,4 @@ +asdf /* * FTM externals * Copyright (C) 2004 by IRCAM-Centre Georges Pompidou, Paris, France. @@ -254,15 +255,32 @@ snprintf(text, 512, "%s %s %s ", description, sep, name); jfont_text_measure(jf, text, &width, &height); + jfont_destroy(jf); new_size.height = height + 6; new_size.width = width + 8; if (self->activeview && patcherview_get_presentation(self->activeview) != 0) - jbox_set_presentation_size((t_object *) self, &new_size); + { + t_size old_size; + jbox_get_presentation_size((t_object *) self, &old_size); + + if (old_size.width != new_size.width || old_size.height != new_size.height) + { + jbox_set_presentation_size((t_object *) self, &new_size); + jbox_redraw((t_jbox *)self); + } + } else - jbox_set_patching_size((t_object *) self, &new_size); - - jbox_redraw((t_jbox *)self); + { + t_size old_size; + jbox_get_patching_size((t_object *) self, &old_size); + + if (old_size.width != new_size.width || old_size.height != new_size.height) + { + jbox_set_patching_size((t_object *) self, &new_size); + jbox_redraw((t_jbox *)self); + } + } } static void @@ -321,6 +339,7 @@ jbox_redraw((t_jbox *)self); } + jfont_destroy(jf); self->changing_size = 0; } @@ -617,6 +636,7 @@ else object_method(textfield, gensym("settext"), description); // set text to be drawn } + jfont_destroy(jf); } static void @@ -671,7 +691,8 @@ snprintf(text, 512, "%s %s", description, sep); jfont_text_measure(jf, text, &width, &height); - + jfont_destroy(jf); + // get zoom object_attr_getvalueof(view, gensym("zoomfactor"), &ac, &at); zoom = atom_getfloat(at); @@ -965,6 +986,7 @@ jfont_text_measure(jf, text, &width, &height); min_width = width + 8; + jfont_destroy(jf); bool presentation = self->activeview ? patcherview_get_presentation(self->activeview) != 0 : 0; if (presentation) @@ -2200,7 +2222,8 @@ jf = jfont_create(fn->s_name, JGRAPHICS_FONT_SLANT_NORMAL, JGRAPHICS_FONT_WEIGHT_NORMAL, fs); jfont_text_measure(jf, fts_symbol_name(sym_empty_object_text), &width, &height); - + jfont_destroy(jf); + dictionary_getatoms(d, gensym("patching_rect"), &ac, &at); rect.x = atom_getlong(at); rect.y = atom_getlong(at + 1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |