vmstat WARNS6 cleanup

Peter Schuller peter.schuller at infidyne.com
Sat Jan 8 11:40:31 PST 2005


> If you want to split out the rest of the cleanup, e.g. the statification,
> I can commit that.

Will do.

> Commited with some additional cleanup. I prefer retval as variable name
> over rc, it's also simpler to set the default value to -1. Also if you
> add code, please use the normal file indentation rules.

Apologies. Time to add the appropriate style hook in ~/.emacs...

> Actually, alloca has the disadvantage of putting possible a lot of data
> on the stack. For classic single threaded apps, that's not a problem,
> for multithreaded code it might be.

Yes, I am aware of this. Hence any use of alloca is going to be an optimiation
only, conditional on the buffer size being below some small value -> malloc
would be required anyway so it doesn't solve the exit path issue.

Anyways. I'm actually not such a big fan of this type of thing (I would tend
to just go with malloc unless it is something extremely performance
critical). Just wanted to justify the use of malloc in case dynamic memory
allocations are greatly discouraged as a matter of policy.

> It's also important to keep in mind
> that alloca is not really portable.

I'm aware of this too, but spotted usage of alloca elsewhere, so I figured
it wasn't banned. But point taken. :)

-- 
/ Peter Schuller, InfiDyne Technologies HB

PGP userID: 0xE9758B7D or 'Peter Schuller <peter.schuller at xxxxxxxxxxxx>'
Key retrieval: Send an E-Mail to getpgpkey at xxxxxxxxx
E-Mail: peter.schuller at xxxxxxxxxxxx Web: http://www.scode.org






More information about the Submit mailing list