Skip to content

Instantly share code, notes, and snippets.

@mtmorgan
Last active April 4, 2021 14:26
Show Gist options
  • Save mtmorgan/77f9d92d81830eeb7f254809b445874d to your computer and use it in GitHub Desktop.
Save mtmorgan/77f9d92d81830eeb7f254809b445874d to your computer and use it in GitHub Desktop.
Run valgrind on Bioconductor's docker image
I downloaded the most recent Bioconductor docker 'devel' image
```{sh}
$ docker pull bioconductor/bioconductor_docker:devel
```
The Bioconductor docker container does not contain valgrind. Start by installing it
```{sh}
$ docker run -it --rm bioconductor/bioconductor_docker:devel bash
root@aebe3fe17883:/# apt-get update && apt-get install valgrind
```
Install package(s) to be tested.
```{sh}
root@aebe3fe17883:/# R -e "BiocManager::install('IRanges')"
```
Run suspect code under valgrind
```{sh}
root@aebe3fe17883:/# R -d valgrind -e "IRanges::IRanges(1:622e6, width=1)"
```
The first time I ran this code I saw
```{r}
> IRanges::IRanges(1:622e6, width=1)
==662== Warning: set address range perms: large range [0x59c9d040, 0xee15ae70) (undefined)
==662== Warning: set address range perms: large range [0xee15b040, 0x182618e70) (undefined)
==662== Warning: set address range perms: large range [0x182619040, 0x216ad6e70) (undefined)
KILLED
```
This is unusual, and likely indicates that I ran out of memory in my docker environment. I
updated the amount of memory available to docker (via the menu bar icon 'Preferences...'
on my mac) to 20 GB. Re-running, there were, in this case, no errors:
```{r}
> IRanges::IRanges(1:622e6, width=1)
==662== Warning: set address range perms: large range [0x59c9d040, 0xee15ae70) (undefined)
==662== Warning: set address range perms: large range [0xee15b040, 0x182618e70) (undefined)
==662== Warning: set address range perms: large range [0x182619040, 0x216ad6e70) (undefined)
==662== Warning: set address range perms: large range [0x216ad7040, 0x2aaf94e70) (undefined)
==662== Warning: set address range perms: large range [0x182619028, 0x216ad6e88) (noaccess)
IRanges object with 622000000 ranges and 0 metadata columns:
start end width
<integer> <integer> <integer>
[1] 1 1 1
[2] 2 2 1
[3] 3 3 1
[4] 4 4 1
[5] 5 5 1
... ... ... ...
[621999996] 621999996 621999996 1
[621999997] 621999997 621999997 1
[621999998] 621999998 621999998 1
[621999999] 621999999 621999999 1
[622000000] 622000000 622000000 1
>
>
==662==
==662== HEAP SUMMARY:
==662== in use at exit: 7,622,106,694 bytes in 38,024 blocks
==662== total heap usage: 151,275 allocs, 113,251 frees, 10,307,180,279 bytes allocated
==662==
==662== LEAK SUMMARY:
==662== definitely lost: 0 bytes in 0 blocks
==662== indirectly lost: 0 bytes in 0 blocks
==662== possibly lost: 0 bytes in 0 blocks
==662== still reachable: 7,622,106,694 bytes in 38,024 blocks
==662== of which reachable via heuristic:
==662== newarray : 4,264 bytes in 1 blocks
==662== suppressed: 0 bytes in 0 blocks
==662== Rerun with --leak-check=full to see details of leaked memory
==662==
==662== For lists of detected and suppressed errors, rerun with: -s
==662== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment