- To: Jonathan Wakely <jwakely.gcc@xxxxxxxxx>
- Subject: Re: High memory usage when compiling array of shared_ptr in gcc 4.6.2+
- From: Jens Bauer <jens@xxxxxxxxx>
- Date: Fri, 6 Apr 2012 16:26:30 +0200
- Cc: Philipp Savun <philipp.savun@xxxxxx>, gcc-help@xxxxxxxxxxx
- Comment: DKIM? See http://www.dkim.org
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
- In-reply-to: <CAH6eHdSsRvtJw=Rt8BHTq_fc1K4+vYMueVz+2XUh0pvGh0dqig@mail.gmail.com>
Hi Philipp and Jonathan,
-Ofcourse, Jonathan is right.
I was thinking in the direction: If allocation fails, you have the chance of trying with a smaller buffer.
(I often do this myself, when the size of the buffer can be reduced).
Personally, I always try making my code, so it has low requirements, but can take advantage of available resources.
Love,
Jens
On Fri, 6 Apr 2012 15:06:26 +0100, Jonathan Wakely wrote:
> On 6 April 2012 13:09, Jens Bauer wrote:
>> Hi Philipp,
>>
>> I'd say that's sloppy coding (in my opinion).
>> You should really use malloc for huge buffers, not statically
>> allocated variables.
>
> *ahem*
>
> Maybe std::vector<shared_ptr<SomeClass>> but not malloc.
[Linux C Programming]
[Linux Kernel]
[eCos]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[The DWARVES Debugging Tools]
[Yosemite Campsites]
[Yosemite News]
[Linux GCC]