>>>>> "JNP" == Joshua N Pritikin <[EMAIL PROTECTED]> writes:

  >> so i will have to require explicit shutting down of an accept object to
  >> stop it and cause garbage collection. the shutdown method will stop the
  >> watcher and break the circular link.
  >> 
  >> no big problem, just wanted to clear my thoughts on this. let me know
  >> what you think about it and if you have a better way.

  JNP> 'shutdown' method?  I think you need to call 'cancel'.  If you have
  JNP> a subclass, you can override the cancel method to add your own
  JNP> clean up:

  JNP> sub cancel {
  JNP>   my ($w)=@_;
  JNP>   # ...
  JNP>   $w->SUPER::cancel;
  JNP> }


i don't subclass. i enclose the evnt object in my higher level object in
most cases. the reason is i need more data that you have and i don't
want to risk attribute collisions. one of perl's weakest OO areas. i
also don't want to use damian's complex modules to solve this.

so i will have to have my own method to close a server. and i generally
use different names than you to work in my scheme. $server->shutdown()
is my current choice.

  JNP> I've often thought that maybe Event should switch to weak
  JNP> references to avoid circular links.  Or perhaps the cancel method
  JNP> should release all the SVs owned by the Event.  That might be
  JNP> enough to fix the problem, but I bet someone (maybe me!) is
  JNP> relying on the fact that cancel does not presently disturb any of
  JNP> the watchers settings.  I'm not sure what is the best solution.

my problem is my own circular link highr than yours. so i require an
explicit call to cancel/shutdown which will break the circle and clean
up crap. it should get fully garbage collected. i will be testing this
for memory leaks sometime. my daemons will be running forever and may
create/destroy servers. definitely will create/destroy clients. i can't
afford memory leaks.

uri

-- 
Uri Guttman  ---------  [EMAIL PROTECTED]  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com

Reply via email to