BINGO!
Found it – the leak is in DC.DrawTextList() – if I repalce that call with a loop:
(around line 1859 of FloatCanvas.py)
NOTE: DrawTextList seems to have a memory leak
– calling it thousands of times causes a problem
If the leak gets found and fixed, it may be worth putting the call back
#dc.DrawTextList(self.Words, Points)
for word, point in zip(self.Words, Points):
dc.DrawTextPoint(word, point)
The leak seems to have gone away.
so far, 20,000 iterations with 100 objects, and still pretty steady memory usage.
The weird particularly frustrating part is that I thought I’d tested that with a raw DC, and didn’t see a problem. Oh well.
So I suggest you patch your copy of FloatCanvas with the above, and I’ll submit an update to SVN, and also look more into what may be wrong with DrawTextList (I did write that code originally…and yes, it’s C++…)
Thanks for finding and reporting and testing this bug!
-Chris
···
On Wed, Sep 4, 2013 at 11:40 AM, Chris Barker - NOAA Federal chris.barker@noaa.gov wrote:
On Wed, Sep 4, 2013 at 7:43 AM, Bryan Lott mystickphoenix@gmail.com wrote:
–
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov
So, interesting bit of info… I swapped the ScaledTextBox to ScaledText and the memory leak went away…
It turns out I jsut did the same thing – with the same results – so far 382,000 iterations, with 100 objects, memory up a bit, but pretty stable. Glad to hear you got the same results.
memory use stayed static or just bumped up a couple of bytes every now and again. The question now becomes what’s the difference between a ScaledText object and a ScaledTextBox?
well, as you say, multi-line text – and it pre-computes the relative position of all the words, so there’s a bit more going on there, though still not sure what. But I’ll poke at ti a bit more…
ScaledText doesn’t do exactly what I want (multi-line text) but I should be able to shoehorn it in without too many issues.
Probably the best option for now.
I’d use a regular text object but I do want the user to have zooming abilities as the DB relationship chains can get extremely long in our (convoluted as hell) model.
sure, but the reason regular text is there (and was there first) is because you can only read text so small, and if it gets large, you’re more likely to have text overlapping. But I dont really know your use-case…
Thanks for the update – we’re narrowing it down…
-Chris
–
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov