Also cc'd to tcltk@perl.org https://www.nntp.perl.org/group/perl.tcltk/2018/07/msg718.html
per Vadim's request

At 09:23 AM 7/3/2018, you wrote:
<URL: https://rt.cpan.org/Ticket/Display.html?id=125472 >

VKON wrote:

> I agree with all points.
>
> yet, I think that too careful track on coderefs could result in even
> more memory leaks, not only will grow allocated numbers of CODE
> references, but also grow hash which tracks them.
>
> IMO the best solution to the problem - is documenting it better;
>
> if the problem hurts user - she can elaborate another way in her code,
> change "-command=>sub{}" to "-command=>'tclsub'", where 'tclsub' will
> handle all the job;
>
> maybe warn user in case of 100 allocated coderefs;
>
> IDK. we could solve this problem by just ignoring its existence :):)

Yes, I think it's a good idea to get user warned; but I prefer only on 'use warnings;' specified and criterion to be over 1000 allocated coderefs.

SJ

I think it is important to discriminate between the end user of a tck/tk application and the programmer of that application. What would an end user think if he started getting flooded with warnings for a existing application they use that they cannot control, that only the application developer can modify.

I too think that 100 is too small a threshold. I have a tkx application that provides me buttons to run programs via a deamon running on other boxes. There are 50 buttons for just one of the boxes, and that means 50 menu entries as well. There are 6 other boxes that can be selected (the buttons panel and menu gets recreated when switched) and they too have dozens of buttons and menu items. I am working on using code disposal to keep $anon_refs clean in this application but under v1.02.v1.05 rules of no disposal i could easily generate hundreds of entries to $anon_refs just by cycling thru the different boxes. Each time a button/menu is activated it creates a new toplevel window where the output results of the command executed on the other box gets displayed, and each of these toplevel windows has its own menu as well. I used to keep this application open for weeks at a time, but lately only open and close it as needed to reclaim desktop and task bar space.

To tell you the truth, under v1.02 i did not see a performance penalty to introducing all these entries to $anon_refs and the tcl<=>perl command table. This leads me to believe that 100 may be way to small and even 1000 might be as well.

Reply via email to