valgrind and C++

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

valgrind and C++

Jarrod Hadfield-2
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








--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: valgrind and C++

Martyn Plummer-3
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 confidenti...{{dropped:8}}

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: valgrind and C++

Jarrod Hadfield-2
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 <[hidden email]> 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}}

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel