Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #30459

Re: Implementing TCL/CCI commands in JavaTCL

Newsgroups comp.lang.java.programmer
Date 2014-11-30 21:44 -0800
References <91e0be65-71fb-4bbd-a509-0a0a8bf22f84@googlegroups.com> <slrnm7mllg.uoi.avl@login.logic.tuwien.ac.at>
Message-ID <f2f2a0e0-90c8-4ccc-b558-4725d17ffaba@googlegroups.com> (permalink)
Subject Re: Implementing TCL/CCI commands in JavaTCL
From nataraja gadikota <nataraja.3.833@gmail.com>

Show all headers | View raw


Hi Andreas , 
     Yes I've posted this on comp.lang.tcl too , 
I didn't know where TclJava Authors will hangout so ..
https://groups.google.com/forum/#!topic/comp.lang.tcl/wd0EWIopNYE

>>It's not completely clear to me, what you really want.
Backend I'm implementing CCI like below .

// Golbal Variable 
hashMap<String,ArrayList<objects> collectionList ; 
ArrayList<my_objects> collectionObjects; 
collectionObjects = new ArrayList<my_objects>() ; 
collectionList.put(0x11,collectionObjects); 

#set a ""  or
#when varaible 'a' is set to different collection . 
#I've to remove this pair
collectionList.delete(0x11); 

and then "collectionObjects" will be GC 
my problem is how to trace this .

Initial I thought of overriding var.SetVar method but this was defined as final , so went into TCLJava code and to  my suprise saw more than 10 variants of setVar function in Var.java !!
I was not able to add proper hooks , so here I'm .

Thanks
Nataraja G

On Sunday, 30 November 2014 23:11:14 UTC+5:30, Andreas Leitgeb  wrote:
> Although the topic involves both Tcl and Java, I think
>   comp.lang.tcl
> might have been the better group for this question.
> 
> > dc_shell> set a [get_cells reset_port*] ;# -> 0x11 
> > dc_shell > sizeof_collection 0x11       ;# -> ok
> > dc_shell > set a "" 
> > dc_shell > sizeof_collection 0x11       ;# -> TCL ERROR 
> 
> Something seems to explicitly tie lifetime of the collection
> to the lifetime of that one particular "0x11" instance returned
> from "get_cells".
> 
> That's just outright ugly design of CCI.
> 
> > Can you tell me know to keep track of TCL_Object and 
> > free resources when there are no references pointing to them . 
> 
> It's not completely clear to me, what you really want.
> 
> There was a reference stored in variable a, and once that's gone, the
> collection is gone.  (This is not following Tcl-design, but seems to
> work sufficiently well on sunny days...)
> 
> The real problem seems to be the condition: "when no refs point to them",
> as for some time any newly generated "0x11" string could be considered a
> reference, but if the one originally saved away is freed, then all others
> turn stale. An ugly consequence of CCI's ugly design.
> 
> If you ignore this detail of creating new "pseudo"-references, and
> just copied the value $a to every "user", you should just get what
> you seem to be asking for.
> 
> > and I'm using TCL-Java where garbage collection is been done by Java.GC 
> > this is another headache ! 
> 
> Tcl_Objects "cannot" have loops in their referencial paths,
> because by design they're immutable. That makes explicit 
> refcounting a good approach in native Tcl, whereas the Java
> based implementation of Tcl has dropped the ref-counter and just
> leaves it to the JVM to collect the garbage. Either way, unused
> Objects get collected sooner(refcount) or later(GC).

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Implementing TCL/CCI commands in JavaTCL nataraja.3.833@gmail.com - 2014-11-29 23:54 -0800
  Re: Implementing TCL/CCI commands in JavaTCL Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-11-30 17:40 +0000
    Re: Implementing TCL/CCI commands in JavaTCL nataraja gadikota <nataraja.3.833@gmail.com> - 2014-11-30 21:44 -0800

csiph-web