-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Milestone
Description
The assignment below (several instances of which exist in dplyr.cpp) has a gc protection problem: the object returned by shallow_copy(data) is unprotected upon return, while the DataFrame_Impl constructor (highlighted with __ below) creating the copy object will do an allocation in the default Vector constructor (from which DataFrame_Impl inherits) that will collect the unprotected result of shallow_copy(data) before it can be protected by the set__(x) call in the DataFrame_Impl constructor.
// -- dplyr.cpp
DataFrame copy = shallow_copy(data) ;
// -- DataFrame.h
template <template <class> class StoragePolicy>
class DataFrame_Impl : __public Vector<VECSXP, StoragePolicy>__ {
public:
typedef Vector<VECSXP, StoragePolicy> Parent ;
DataFrame_Impl() : Parent( internal::empty_data_frame() ){}
DataFrame_Impl(SEXP x) {
set__(x);
}
// -- Vector.h (in Rcpp)
Vector() {
Storage::set__( Rf_allocVector(RTYPE, 0 ) );
init() ;
}
Metadata
Metadata
Assignees
Labels
No labels