Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I transfer an issue related to memory leak #5

Closed
datagistips opened this issue Feb 4, 2016 · 7 comments
Closed

I transfer an issue related to memory leak #5

datagistips opened this issue Feb 4, 2016 · 7 comments

Comments

@datagistips
Copy link

Hi,

For one purpose, I had to deploy an R script including RStoobox with an execuatble windows batch to many users.

I am french and I noticed that the printed accents like é were not displayed well after RStoobox was loaded.

I contacted an R forum to explain my problem. One person made tests to see what was going on.

She wrote the following script named bugged.R

cat("\n\nà â ï î é è ô ü ç\n\n")
require("RStoolbox")
cat("\n\nà â ï î é è ô ü ç\n\n")

She tested the code against valgrind
R -d "valgrind --leak-check=full --show-reachable=yes --xml=yes --xml-file=valgrind_out.xml" -f bugged.R

grep '<kind>' valgrind_out.xml valgrind_out_good.xml | uniq

And it gave the following output

valgrind_out.xml:  <kind>Leak_StillReachable</kind>
valgrind_out.xml:  <kind>Leak_DefinitelyLost</kind>
valgrind_out.xml:  <kind>Leak_StillReachable</kind>
valgrind_out.xml:  <kind>Leak_PossiblyLost</kind>
valgrind_out.xml:  <kind>Leak_StillReachable</kind>
valgrind_out_good.xml:  <kind>Leak_StillReachable</kind>
valgrind_out_good.xml:  <kind>Leak_PossiblyLost</kind>
valgrind_out_good.xml:  <kind>Leak_StillReachable</kind>

To quote her, she said Leak_DefinietelyLost was a leak of memory and she advised me to warn you about this issue.

Here is the forum link

RStoolbox is an awesome package

@bleutner
Copy link
Owner

bleutner commented Feb 4, 2016

This is not directly an RStoolbox issue but results from importing the rgeos package, which in turn has this memory leak. However, since you won't load rgeos or RStoolbox millions of times during your session I don't think this is an important issue.

To strip your example down to the core for future reference:
R -d "valgrind --leak-check=full --show-reachable=yes" -e 'library(rgeos)'
and
R -d "valgrind --leak-check=full --show-reachable=yes" -e 'library(RStoolbox)'

will both report
definitely lost: 1,096 bytes in 1 blocks

@bleutner bleutner closed this as completed Feb 4, 2016
@bleutner
Copy link
Owner

bleutner commented Feb 4, 2016

Of course, feel free to report this upstream, i.e. at rgeos
Thanks for your report anyways.

@datagistips
Copy link
Author

Hi

Thanks for all the information

What I do not understand is why you mention rgeos. Do you mean rgeos is
loaded when we call RStoolbox ?

Sorry for asking you this but I am a bit newbie in this kind of stuff

Best

Mathieu
Le 4 févr. 2016 15:48, "Benjamin Leutner" notifications@github.com a
écrit :

Of course, feel free to report this upstream, i.e. at rgeos
Thanks for your report anyways.


Reply to this email directly or view it on GitHub
#5 (comment).

@bleutner
Copy link
Owner

bleutner commented Feb 4, 2016

rgeos is imported by RStoolbox, which means its functions are available internally for RStoolbox, i.e. inside the RStoolbox namespace but are not available globally, i.e. to you. Thus, if you want to use rgeos, you'd still call library(rgeos) yourself (this is called attaching the package to the global search path).

If you look at the DESCRIPTION file of any package you see all packages which are imported fully or partially under IMPORTS. Contrastingly, everything that's listed under DEPENDS behaves as if you would call library(package) yourself.

@datagistips
Copy link
Author

Ok thanks I understand now

Thanks for the awesome package

I used it to make a script that with spgrass, rgeos also, detects all the
blue pixels on RGB topo maps so as to extract rivers as vectors and feed an
inventory of rivers subject to water policies. It will be useful for the
national french agencies who depend from the Ministry of Ecology, for whom
I work
Le 4 févr. 2016 19:48, "Benjamin Leutner" notifications@github.com a
écrit :

rgeos is imported by RStoolbox, which means its functions are available
internally for RStoolbox, i.e. inside the RStoolbox namespace but are
not available globally, i.e. to you. Thus, if you want to use rgeos, you'd
still call library(rgeos) yourself (this is called attaching the
package to the global search path).

If you look at the DESCRIPTION file of any package you see all packages
which are imported fully or partially under IMPORTS. Contrastingly,
everything that's listed under DEPENDS behaves as if you would call
library(package) yourself.


Reply to this email directly or view it on GitHub
#5 (comment).

@gifi
Copy link

gifi commented Feb 5, 2016

Hi @bleutner and @datagistips
I am the person who brought Valgrind into all of this. While you two were discussing about RStoolbox, the rgeos' maintainer and I was having some argument on how to resolve the issue Matthieu had. I made the bits available in the original thread. They are wrote mainly in English.
So even Benjamin might be interested to take a look at them. I am assuming French is not a language you, Benjamin, don't use to speak/read, all my bad if I am wrong.
The URL: http://www.developpez.net/forums/d1564087/autres-langages/autres-langages/r/rscript-batch-e-accent-aigue/#post8524546
Cheers,
Eric.

@bleutner
Copy link
Owner

bleutner commented Feb 5, 2016

Hi Eric,

thanks for letting me know. I've got no clue about what went wrong with this locale switching, so I'm glad updating solved it.

Indeed, my rusty French will only buy me some bread, but not much more ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants