Re: vmstat WARNS6 cleanup

看板DFBSD_submit作者時間21年前 (2005/01/09 05:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串6/10 (看更多)
:On Sat, Jan 08, 2005 at 08:48:34PM +0100, Peter Schuller wrote: :> 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. : :In almost all cases, malloc is better than alloca, if only to warrant some :extra care to free the memory and therefore keep track of what you :allocated. Yes, this is exactly the reverse of Garbage Collection, but :GC is not always The Right Thing (TM). : :Therefore patches to change alloca uses correctly into malloc / free uses :or other great stack allocations are certainly welcome. Keep in mind though, :that we don't bother about one or two pages of stack in a leaf function, :but anything above let's say 32 pages [add other arbitrary value here] :should be really investigated. : :Joerg Yah, I agree. I would go further to say that alloca should just be removed from the utility source entirely. Performance is almost never an issue in the places where alloca is used, and when performance is an issue (the one time out of a hundred where it is), one would just pre-allocate or pre-cache or cache/realloc the required memory buffer. -Matt Matthew Dillon <dillon@backplane.com>
文章代碼(AID): #11u55P00 (DFBSD_submit)
討論串 (同標題文章)
文章代碼(AID): #11u55P00 (DFBSD_submit)