[Libav-user] g++ 4.7.2 fails to compile av_err2str

"René J.V. Bertin" rjvbertin at gmail.com
Mon Jan 14 20:41:29 CET 2013


On Jan 14, 2013, at 19:14, Nicolas George wrote:
> 
> I checked both in the man page (from gcc+glibc) and a test program: if you
> use alloca() inside a loop, it returns a new block each time, while a
> compound literal has always the same address. The man page says:

Ok. Note however that a changing address doesn't mean that the previous block wasn't allocated.

> Except that there is no garbage collection when the memory runs out. I count
> a block of memory that is freed later than expected without way of catching
> it as a leak. Otherwise, there would be no leaks possible, all memory is
> freed when a process terminates.

True (though that wasn't always the case). 

Seems like this would speak for using a local std::string instance in C++ code where a compound literal cannot be used.

R.


More information about the Libav-user mailing list