DragonFly BSD
DragonFly submit List (threaded) for 2005-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: vmstat WARNS6 cleanup


From: Peter Schuller <peter.schuller@xxxxxxxxxxxx>
Date: Sat, 8 Jan 2005 20:48:34 +0100

> 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@xxxxxxxxxxxx>'
Key retrieval: Send an E-Mail to getpgpkey@xxxxxxxxx
E-Mail: peter.schuller@xxxxxxxxxxxx Web: http://www.scode.org




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]