From j.hadfield at ed.ac.uk  Tue Mar 18 18:26:47 2014
From: j.hadfield at ed.ac.uk (Jarrod Hadfield)
Date: Tue, 18 Mar 2014 17:26:47 +0000
Subject: [Rd] valgrind and C++
In-Reply-To: <1395161635.15618.4.camel@braque.iarc.fr>
References: <20140317172612.14976udr7chlzlcs@www.staffmail.ed.ac.uk>
	<1395161635.15618.4.camel@braque.iarc.fr>
Message-ID: <20140318172647.1500618e886bcwco@www.staffmail.ed.ac.uk>

Hi Martyn,

Thanks for the email - you are right. I thought I was getting the  
valgrind checks on my submission, not the version on CRAN.

Kind Regards,

Jarrod



Quoting Martyn Plummer <plummerm at iarc.fr> on Tue, 18 Mar 2014 16:53:55 +0000:

> I think the server that runs the valgrind checks is still running the
> old version of your package (2.17) not the new one (2.18). Wait for an
> update.
>
> Martyn
>
> On Mon, 2014-03-17 at 17:26 +0000, Jarrod Hadfield wrote:
>> Hi,
>>
>> I am sorry if this is perceived as a C++ question rather than an R
>> question. After uploading an R library to CRAN (MCMCglmm) the C++ code
>> failed to pass the memory checks.  The errors come in pairs like:
>>
>> Mismatched free() / delete / delete []
>> at 0x4A077E6: free (vg_replace_malloc.c:446)
>> by 0x144FA28E: MCMCglmm (MCMCglmm.cc:2184)
>>
>>
>> Address 0x129850c0 is 0 bytes inside a block of size 4 alloc'd
>> at 0x4A07CE4: operator new[](unsigned long) (vg_replace_malloc.c:363)
>> by 0x144F12B7: MCMCglmm (MCMCglmm.cc:99)
>>
>> which is associated with lines allocating and freeing memory (nG is an
>> integer):
>>
>> int *keep = new int [nG];
>>
>> and
>>
>> delete [] keep;
>>
>> To me this looks fine, and on my machine (Scientific Linux 6.4) using
>> gcc 4.4.7-3 and valgrind 1:3.8.1-3.2 I get no such errors. Its not
>> clear to me which flavour of Linux or compiler the CRAN team used,
>> although from MCMCglmm-Ex.Rout I can see the same version of valgrind
>> was used. Any insight would be very welcome.
>>
>> Kind Regards,
>>
>> Jarrod
>>
>>
>>
>>
>>
>>
>>
>>
>
> -----------------------------------------------------------------------
> This message and its attachments are strictly confiden...{{dropped:17}}



[Rd] valgrind and C++
Jarrod Hadfield