* Melchior FRANZ -- Thursday 18 October 2007:
> The good news: I have a Nasal binding/script cache almost finished.
> I don't know yet if it makes a huge difference, [...]

That's now finished and, as expected, makes firing of bindings between
20% and 90% faster. But I doubt that it will improve any stuttering
problem that some people have. (I still don't have *any* such problem.
I had in the past, and I've only changed the kernel version, libc, and
the nvidia driver since then. Same old crappy hardware.)

While working on the script cache, I noticed that Durk is right about
Nasal's garbage collector (GC). It *has* a bug. And Nasal listeners
trigger it just like keyboard/joystick bindings and possibly also
settimer() calls. I was quite surprised to see that the refcounter
of some SGSharedPtr nodes became bigger and bigger. Apparently Nasal
allocates them, but doesn't free them anymore.

Try the attached Nasal script. It prints every 5 seconds the number
of references to some nodes:

Right after startup:

  5       /input/joysticks/js/axis[3]/binding   # nasal js binding
  24      /sim/current-view/view-number         # some listeners attached

And after around hundred times moving the joystick's throttle lever
and a lot of switching the view, the number of node references is:

  1067    /input/joysticks/js/axis[3]/binding
  1138    /sim/current-view/view-number

So, Nasal has now over thousand unfreed references to the nodes.
And indeed, this matches a counter that I had added to nasal-props.cxx.
There are many more SGSharedPtr allocated than freed! Unfortunately,
Nasal internals aren't exactly my strong side, so I'll have to leave
that to Andy.  :-)


m.



PS: the timing alerts are getting quite annoying. They pointed us to
    some weak spots, but that's it. They will hardly help any further
    to fix the stuttering problem. (And the warning code isn't exactly
    written efficiently. It rather *contributes* to the problem.  ;-)
var nodes = [
        "/input/joysticks/js/axis[3]/binding",  # js throttle binding
        "/sim/current-view/view-number",        # listener node
];

var loop = func {
        foreach (var n; nodes)
                print(n.getAttribute("refcount"), "\t", n.getPath());
        print();
        settimer(loop, 5);
}

settimer(func {
        forindex (var i; nodes)
                nodes[i] = props.globals.getNode(nodes[i], 1);
        loop();
}, 0);

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to