-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Overhaul memory smart pointer (#149)
* Add smart pointer wrapper utility Add a new file "smart_ptr.h" to simplify the use of Boost intrusive pointers. This includes template aliases for reference-counted smart pointers and their base class, enhancing memory management in the project. Additionally, update the CMakeLists.txt to include the new header file. * Switch to custom smart pointers. Replaced Boost intrusive pointers with the custom Rc smart pointers across multiple headers for consistency and potential performance improvements. This change impacts device handling, algebra context, basis, and linear operator functionalities. * Replace boost smart pointers with custom smart pointers Refactored the code to use the internal `Rc` smart pointers instead of `boost::intrusive_ptr`. This change improves maintainability and reduces dependency on external libraries. Included necessary header files for the new smart pointers. * Replace Boost intrusive_ref_counter with mem::RcBase Transition from Boost's intrusive_ref_counter to mem::RcBase for better memory management consistency across the codebase. This adjustment affects the DeviceHandle, ContextBase, and BasisInterface classes.
- Loading branch information
1 parent
1e1447c
commit 49b682f
Showing
13 changed files
with
60 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// Created by sammorley on 10/11/24. | ||
// | ||
|
||
#ifndef ROUGHPY_CORE_SMART_PTR_H | ||
#define ROUGHPY_CORE_SMART_PTR_H | ||
|
||
#include <boost/smart_ptr/intrusive_ptr.hpp> | ||
#include <boost/smart_ptr/intrusive_ref_counter.hpp> | ||
|
||
namespace rpy { | ||
|
||
|
||
namespace mem { | ||
|
||
template <typename T> | ||
using Rc = boost::intrusive_ptr<T>; | ||
|
||
template <typename T, typename Policy=boost::thread_safe_counter> | ||
using RcBase = boost::intrusive_ref_counter<T, Policy>; | ||
|
||
|
||
|
||
} | ||
|
||
|
||
using mem::Rc; | ||
|
||
|
||
} | ||
|
||
#endif //ROUGHPY_CORE_SMART_PTR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters