In certain functions in GSL (GNU Scientific Library), some functions take a "workspace" environment as an argument. For example, gsl_poly_dd_taylor from this page. Why? Wouldn't it be easier for the function to allocate its own memory, or at least the same difficulty? I suppose that this allows the caller to specify where the function works, but I don't see how it helps.


Efficiency. GSL is designed to be both time and memory efficient and it makes more sense to pass around the same workspace than have each and every function allocate and free its own.

  • Makes sense. Hadn't thought about reusing the same workspace. Thanks! – David Millard Oct 31 '12 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.