← Back to team overview

unity-dev team mailing list archive

Re: [Ayatana-dev] C++ memory allocation

 

On 9/20/2011 10:48 PM, Ted Gould wrote:
On Wed, 2011-09-21 at 11:43 +1200, Tim Penhey wrote:
We can see that calloc is faster only at small sizes.  What's more, the
overhead of using a std::vector decreases rapidly as the size gets
larger.
And aren't almost all allocations in most programs smaller in nature.
Especially GUI programs and toolkits.  The only place I could think we'd
even come close to "large" allocations would be in buffer images, and
there shouldn't be too many of those.

I think that the old adage still holds: If you want something done
right, do it yourself.  But often times you're willing to take the
penalty and outsource the work to the standard lib to make life easy in
non-critical sections.  So "use the appropriate technology for the code
in question." ;-)

		--Ted
The section in question creates a buffer of data to load into and OpenGL texture. So the data can be large. However, in that location, we are doing 1 allocation and then we exit. Is one really better than the other in this case?

Jay



Follow ups

References