==4092724== Memcheck, a memory error detector
==4092724== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==4092724== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==4092724== Command: /usr/lib/R/bin/exec/R --no-save --vanilla
==4092724== 

R version 4.4.1 (2024-06-14) -- "Race for Your Life"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> Rcpp::sourceCpp("apply.cpp")
> X = matrix(1:12, 4, 3)
> out = apply_ex(X)
> print(out)
$pows
     [,1] [,2] [,3]
[1,]    1   25   81
[2,]    4   36  100
[3,]    9   49  121
[4,]   16   64  144

$rowsums
[1] 15 18 21 24

$colsums
[1] 10 26 42

> 
> 
==4092724== 
==4092724== HEAP SUMMARY:
==4092724==     in use at exit: 59,588,648 bytes in 11,441 blocks
==4092724==   total heap usage: 31,815 allocs, 20,374 frees, 92,977,959 bytes allocated
==4092724== 
==4092724== LEAK SUMMARY:
==4092724==    definitely lost: 0 bytes in 0 blocks
==4092724==    indirectly lost: 0 bytes in 0 blocks
==4092724==      possibly lost: 0 bytes in 0 blocks
==4092724==    still reachable: 59,588,648 bytes in 11,441 blocks
==4092724==                       of which reachable via heuristic:
==4092724==                         newarray           : 4,264 bytes in 1 blocks
==4092724==         suppressed: 0 bytes in 0 blocks
==4092724== Reachable blocks (those to which a pointer was found) are not shown.
==4092724== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==4092724== 
==4092724== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
