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

Issues with memory management in fmelt #6248

Merged
merged 5 commits into from
Jul 13, 2024
Merged

Issues with memory management in fmelt #6248

merged 5 commits into from
Jul 13, 2024

Conversation

MichaelChirico
Copy link
Member

@MichaelChirico MichaelChirico commented Jul 12, 2024

As identified by rchk on CRAN:

https://raw.githubusercontent.com/kalibera/cran-checks/master/rchk/results/data.table.out

Function checkVars
  [UP] allocating function uniq_diff may destroy its unprotected argument (measure_int_or_list <arg 1>), which is later used. data.table/src/fmelt.c:251
Function uniq_diff
  [UP] calling allocating function set_diff(V,?) with a fresh pointer (unique_col_numbers <arg 1>) data.table/src/fmelt.c:201

Note that the cols_to_int_or_list() output is indeed PROTECT()'d properly in other nearby branches. This makes sense because measure_int_or_list is a new SEXP not yet on the stack that must be marked against gc removal.

@MichaelChirico MichaelChirico changed the title Update fmelt.c PROTECT() a new SEXP in fmelt Jul 12, 2024
Copy link

github-actions bot commented Jul 12, 2024

Comparison Plot

Generated via commit ea67015

Download link for the artifact containing the test results: ↓ atime-results.zip

Time taken to finish the standard R installation steps: 12 minutes and 10 seconds

Time taken to run atime::atime_pkg on the tests: 3 minutes and 23 seconds

@MichaelChirico MichaelChirico changed the title PROTECT() a new SEXP in fmelt Issues with memory management in fmelt Jul 12, 2024
Copy link
Member

@tdhock tdhock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great. I wrote this code and I guess forgot a PROTECT, thanks for looking at rchk results and providing a fix. add a NEWS item?

@tdhock
Copy link
Member

tdhock commented Jul 13, 2024

does this one fix handle all three rchk issues in fmelt.c?


Function checkVars
  [UP] allocating function uniq_diff may destroy its unprotected argument (measure_int_or_list <arg 1>), which is later used. data.table/src/fmelt.c:251
  [UP] calling allocating function uniq_diff with a fresh pointer (measure_int_or_list <arg 1>) data.table/src/fmelt.c:251
  [UP] unprotected variable measure_int_or_list while calling allocating function Rf_allocVector data.table/src/fmelt.c:254

I'm not used to reading / understanding these messages, are some redundant with each other?

@MichaelChirico
Copy link
Member Author

does this one fix handle all three rchk issues in fmelt.c?

I'm also not sure, but yes that's my read.

I'll add NEWS in a bit

@MichaelChirico MichaelChirico merged commit 73c1c23 into master Jul 13, 2024
4 checks passed
@MichaelChirico MichaelChirico deleted the fmelt-protect branch July 13, 2024 15:56
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

Successfully merging this pull request may close these issues.

None yet

2 participants