Re: Why is the kfree() argument const?

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Chris Friesen
Date: Friday, January 18, 2008 - 8:38 am

David Schwartz wrote:


I don't think that kfree() itself changes the state of the object.  It 
doesn't call a destructor or anything like that, so the object itself 
must be "inert" before the call to kfree().  That is, at the time of the 
kfree() call the system must have ensured that the object will no longer 
be used by anything.

The call to kfree() is simply bookkeeping--allowing that memory to be 
reused by other parts of the kernel.


I have a certain amount of sympathy for this view...it's a fairly 
painless way to reduce the likelihood of errors.  At the same time, I 
don't think I've ever run into this problem myself--is it really all 
that common?

Chris
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
RE: Why is the kfree() argument const?, Linus Torvalds, (Thu Jan 17, 2:25 pm)
RE: Why is the kfree() argument const?, David Schwartz, (Thu Jan 17, 3:28 pm)
RE: Why is the kfree() argument const?, Linus Torvalds, (Thu Jan 17, 4:10 pm)
RE: Why is the kfree() argument const?, David Schwartz, (Thu Jan 17, 5:56 pm)
RE: Why is the kfree() argument const?, Linus Torvalds, (Thu Jan 17, 6:15 pm)
RE: Why is the kfree() argument const?, David Schwartz, (Thu Jan 17, 10:02 pm)
Re: Why is the kfree() argument const?, Giacomo Catenazzi, (Fri Jan 18, 1:20 am)
Re: Why is the kfree() argument const?, Vadim Lobanov, (Fri Jan 18, 1:30 am)
Re: Why is the kfree() argument const?, Giacomo A. Catenazzi, (Fri Jan 18, 4:47 am)
Re: Why is the kfree() argument const?, Björn, (Fri Jan 18, 6:31 am)
Re: Why is the kfree() argument const?, Andy Lutomirski, (Fri Jan 18, 6:53 am)
Re: Why is the kfree() argument const?, Andy Lutomirski, (Fri Jan 18, 6:54 am)
Re: Why is the kfree() argument const?, Jakob Oestergaard, (Fri Jan 18, 7:39 am)
Re: Why is the kfree() argument const?, Chris Friesen, (Fri Jan 18, 8:38 am)
RE: Why is the kfree() argument const?, Linus Torvalds, (Fri Jan 18, 9:10 am)
Re: Why is the kfree() argument const?, Olivier Galibert, (Fri Jan 18, 10:24 am)
Re: Why is the kfree() argument const?, Olivier Galibert, (Fri Jan 18, 10:37 am)
Re: Why is the kfree() argument const?, DM, (Fri Jan 18, 11:06 am)
Re: Why is the kfree() argument const?, Vadim Lobanov, (Fri Jan 18, 12:06 pm)
Re: Why is the kfree() argument const?, Vadim Lobanov, (Fri Jan 18, 12:14 pm)
Re: Why is the kfree() argument const?, Vadim Lobanov, (Fri Jan 18, 12:55 pm)
RE: Why is the kfree() argument const?, David Schwartz, (Fri Jan 18, 1:55 pm)
Re: Why is the kfree() argument const?, J.A. , (Fri Jan 18, 3:29 pm)
Re: Why is the kfree() argument const?, Krzysztof Halasa, (Fri Jan 18, 4:44 pm)