Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] mcalloc vs. mmalloc

Date2006-08-11 14:38
FromMichael Gogins
SubjectRe: [Cs-dev] mcalloc vs. mmalloc
As with all of this stuff, take a scientific approach. Write some code both ways and time it. Do your timing using a source code profiler with a lot of loops through the code.

The reason for having mmalloc in addition to mcalloc is that in many cases, one would have to initialize each member of a struct with a certain value anyway, so there is no gain from initializing it to zero first. 

However, I wouldn't just ASSUME that mmalloc is going to be significantly faster than mcalloc. If they're about equally fast, then it's safer to always use mcalloc.

Best,
Mike

-----Original Message-----
>From: Steven Yi 
>Sent: Aug 11, 2006 6:09 AM
>To: Developer discussions 
>Subject: [Cs-dev] mcalloc vs. mmalloc
>
>Hi All,
>
>I was wondering today what the difference was between mmalloc and
>mcalloc is.  It seems that one initializes to zeros while one doesn't.
> Since I'm no C expert, it seems to me that one would want to
>initialize everything in the struct after using either if allocating
>memory that's sizeof(struct) so what their starting state is wouldn't
>matter, so this is a little beyond me when to use which.
>
>Thanks!
>steven
>
>-------------------------------------------------------------------------
>Using Tomcat but need to do more? Need to support web services, security?
>Get stuff done quickly with pre-integrated technology to make your job easier
>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net