On Dec 19, 2010, at 1:09 PM, Alan W. Irwin wrote: > Dave, do you see any downsides > to the above idea as I have fleshed it out?
Only the ones I outlined earlier in this thread... On Dec 18, 2010, at 11:34 AM, David MacMahon wrote: > I think automatic allocation by the library function, while not a big > drawback, has a few potential points against it. One it that memory > allocation is one of the (potentially) more expensive operations, so > minimizing it is desirable. I don't think the use cases in question will > result in this being a significant factor. The other issue is that once the > library has allocated and populated the buffer, language bindings sometimes > (typically?) require that the contents be copied into a suitably sized buffer > that the scripting language manages. In this case the result is a double > allocation (one by the library function, one by the scripting language), a > extra strcpy from library buffer to scripting language buffer, and a free of > the buffer returned by the library function. > > Getting the size first, allocating a buffer using he scripting language > memory management routines, then passing the pointer to the library routine > is, IMHO, more cleanly amenable to scripting language bindings (though I > write mine "manually" so I don't know whether this would apply to SWIG > generated bindings). > > Again, I don't think these factors will be significant for the functions > under discussion, so I'll be happy with whatever consensus emerges. Dave ------------------------------------------------------------------------------ Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel