how to 'free' a matrix ?


    Mar 29 2006 | 11:34 pm
    Hey there,
    i'm discovering the joys of javascript, and i'm making a kind of 'coll' object to store matrices. i send it a keyword and a matrix, and the script makes a new matrix internally, copies the input into it, and puts both keyword and matrix in an array within a 'Global' namespace.
    It works and all is great, but I discover that my copied matrices persist even after deleting them from my delay. they stop existing when I delete the 'Global' object in which namespace they live, so to say.
    but how can I 'free' an individual javascript-created jit.matrix object ? is there something like
    myMatrix.free(); ???
    am I making myself a bit clear ? the problem is probably somewhere in my knowledge of how javascript created, maintains and disposes of objects, universes in general...
    any info very welcome !!
    ciao,
    Joost.
    -------------------------------------------
    Joost Rekveld ----------- http://www.lumen.nu/rekveld
    -------------------------------------------
    "For tribal man space was the uncontrollable mystery. For technological man it is time that occupies the same role." (Marshall McLuhan)
    -------------------------------------------

    • Mar 29 2006 | 11:44 pm
    • Mar 29 2006 | 11:53 pm
      Hi Joost,
      I think freepeer() is what you're looking for. Not completely sure, but I've seen it before in jitter js.
      hth, T_
    • Mar 30 2006 | 12:00 am
      As I believe is mentioned in the MaxMSP mailing list archives, it is mymatrix.freepeer() to free the C peer object. Same is true for Sketch, and Image. The general problem is that the JS GC doesn't know about the C peer's memory and doesn't prioritize the collection of JS garbage which is small despite the C peer's memory. So for these cases you need to free the peer (or explicitly run the GC, which happens to happen in new JitterObject() FWIW).
      -Joshua
    • Mar 30 2006 | 12:18 am
      thanks Joshua and Thijs for the swift and exact reply... now all is fine and I can go to bed peacefully...
      ciao,
      Joost.
      -------------------------------------------
      Joost Rekveld ----------- http://www.lumen.nu/rekveld
      -------------------------------------------
      "The mystery of the world is the visible, not the invisible" (Oscar Wilde)
      -------------------------------------------