R extension memory leak detection question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

R extension memory leak detection question

xiaoyan yu
I am writing C++ program based on R extensions and also try to test the
program with google address sanitizer.

I thought if we don't protect the variable from the allocation API such as
Rf_allocVector, there will be a memory leak. However, the address sanitizer
didn't report it. Is my understanding correct? Or I will see the memory
leak only if I compile R source code with the address sanitizer.

 Please help!

Thanks,
Xiaoyan

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: R extension memory leak detection question

Bert Gunter-2
This is the wrong list for such questions. Post to r-devel instead.

Cheers,

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Fri, Mar 12, 2021 at 9:13 AM xiaoyan yu <[hidden email]> wrote:

> I am writing C++ program based on R extensions and also try to test the
> program with google address sanitizer.
>
> I thought if we don't protect the variable from the allocation API such as
> Rf_allocVector, there will be a memory leak. However, the address sanitizer
> didn't report it. Is my understanding correct? Or I will see the memory
> leak only if I compile R source code with the address sanitizer.
>
>  Please help!
>
> Thanks,
> Xiaoyan
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: R extension memory leak detection question

Duncan Murdoch-2
In reply to this post by xiaoyan yu
On 12/03/2021 12:13 p.m., xiaoyan yu wrote:
> I am writing C++ program based on R extensions and also try to test the
> program with google address sanitizer.
>
> I thought if we don't protect the variable from the allocation API such as
> Rf_allocVector, there will be a memory leak. However, the address sanitizer
> didn't report it. Is my understanding correct? Or I will see the memory
> leak only if I compile R source code with the address sanitizer.
>

Your question is unclear without an actual example.  It all depends on
how the variable was created and how you use it.

If your real code is only a few lines, post it here.  Otherwise, please
put together a minimal working example that contains the essence of what
you are doing in a few lines.  Check that it compiles, and we can
provide advice about whether it is doing dangerous things.

Duncan Murdoch

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: R extension memory leak detection question

Duncan Murdoch-2
On 12/03/2021 12:37 p.m., Duncan Murdoch wrote:

> On 12/03/2021 12:13 p.m., xiaoyan yu wrote:
>> I am writing C++ program based on R extensions and also try to test the
>> program with google address sanitizer.
>>
>> I thought if we don't protect the variable from the allocation API such as
>> Rf_allocVector, there will be a memory leak. However, the address sanitizer
>> didn't report it. Is my understanding correct? Or I will see the memory
>> leak only if I compile R source code with the address sanitizer.
>>
>
> Your question is unclear without an actual example.  It all depends on
> how the variable was created and how you use it.
>
> If your real code is only a few lines, post it here.

Sorry, to R-devel, not here.


  Otherwise, please
> put together a minimal working example that contains the essence of what
> you are doing in a few lines.  Check that it compiles, and we can
> provide advice about whether it is doing dangerous things.
>
> Duncan Murdoch
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.