[torqueusers] torque C library memory issues

Garrick Staples garrick at clusterresources.com
Thu Sep 21 15:52:51 MDT 2006

On Thu, Sep 21, 2006 at 03:31:34PM +0200, Marcin Grabda alleged:
> Hello.
> I have been writing a wrapper around torque library. The most needed
> parts have already been written and I have to deal with memory issues
> now.

For examples, the TORQUE clients are pretty easy to read, or look at
perl-PBS or pbs_python.

> In pbs_submit function manual there is mentioned that the returned job
> identifier string returned by the function must be released via a call
> to free(). It is rather obvious, but what about parameters passed to
> this function? Are they released or am I forced to release them after
> the call? What about other functions?

pbs_submit() returns a pointer to malloc()'d memory, so you have to free
it.  But the arguments are only inputs to the function, so obviously it
won't try and free() what could be static memory.

> There is a pbs_statfree function in PBS library. Are there such
> equivalents to other structures? Or maybe they are not needed?

Use pbs_statfree() for the batch_status linked list returned from the
functions, but the attrib lists you have to handle yourself.

More information about the torqueusers mailing list