[Laszlo-user] are pointers retrieved from getPointer() a potential memory leak?

Elliot Winard enw at laszlosystems.com
Fri Jan 4 08:20:44 PST 2008


I'm looking at code that I wrote a few months ago that make a bunch of 
xpath queries using the following syntax -
         var netstat=dsStatus.getPointer().xpathQuery("netstatus")
or
         var 
netstat=dsStatus.getPointer().xpathQuery("netstatus[@id="+theid+"")

I just looked at the platform code for the LzDataset.getPointer 
function, and it basically does this -
    var dp = new LzDatapointer( null );
    dp.p = this.getContext();
    return dp;

My question.... Is it true that these datapointers are a leak if they're 
not explicitly destroyed because the datapointer returned by 
getPointer() retain a reference to a dataset that will remain in 
existance for the duration of the application (dsStatus)?  If so, what's 
the best way to decouple these linked datapointers, especially because 
LzDatapointer.destroy is marked @access private so it's not undocumented.

Note that I already started replacing the datapointers created inline 
with singleton datapointers and call setPointer() on them before making 
xpath queries.  I'm still wondering about dataset.getPointer() as a 
potential leak.

Thanks,
-e


More information about the Laszlo-user mailing list