LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] thoughts on malloc...

[ILUG] thoughts on malloc...

Nick Murtagh murtaghn at tcd.ie
Tue Mar 26 17:49:31 GMT 2002


On Tuesday 26 March 2002 17:38, kevin lyda wrote:
> not really.  the idea would be this:
>
> declare somefunc(taking some args):
>     reservation = malloc_reserve(calc amount, RESERVE_CALLS, calc calls)
>     if (reservation == 0):
> 	return failure
>     end if

Ok, that makes the code neater. The parameters you're using are pretty hand-
wavey though. Surely you'd just pass an upper bound in bytes? Why would
it care how many calls you are going to make? And in terms of error detection
in turns multiple potential small leaks into one giant potential leak, which
is a big improvement but not ideal (probably as good as you'll get in C I
imagine).

> so the data is allocated a few milliseconds early.  big deal.  it's worth

In that example. But over an entire system you're bound to notice the effect.

> it for how much clearer the code would be.  and yes, you can clean some
> of it up with goto's, but only some and it still means that very low
> level error checking has to pepper your code.

Yes, it'd be nice to find a solution that doesn't involve spaghetti code or 
goto :)




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell