Skip to content

Commit 88c6531

Browse files
committed
Fix a double-free error by removing a static object.
1 parent d4a5db8 commit 88c6531

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

src/axom/core/execution/execution_space.hpp

+13-18
Original file line numberDiff line numberDiff line change
@@ -127,30 +127,25 @@ namespace axom
127127
{
128128

129129
/// \brief Return default allocator id for a runtime policy.
130-
static const std::map<axom::runtime_policy::Policy, int> s_policyToDefaultAllocatorID {
131-
{axom::runtime_policy::Policy::seq,
132-
axom::execution_space<axom::SEQ_EXEC>::allocatorID()}
130+
inline int policyToDefaultAllocatorID(axom::runtime_policy::Policy policy)
131+
{
132+
return
133133
#if defined(AXOM_RUNTIME_POLICY_USE_OPENMP)
134-
,
135-
{axom::runtime_policy::Policy::omp,
136-
axom::execution_space<axom::OMP_EXEC>::allocatorID()}
134+
policy == axom::runtime_policy::Policy::omp
135+
? axom::execution_space<axom::OMP_EXEC>::allocatorID()
136+
:
137137
#endif
138138
#if defined(AXOM_RUNTIME_POLICY_USE_CUDA)
139-
,
140-
{axom::runtime_policy::Policy::cuda,
141-
axom::execution_space<axom::CUDA_EXEC<256>>::allocatorID()}
139+
policy == axom::runtime_policy::Policy::cuda
140+
? axom::execution_space<axom::CUDA_EXEC<256>>::allocatorID()
141+
:
142142
#endif
143143
#if defined(AXOM_RUNTIME_POLICY_USE_HIP)
144-
,
145-
{axom::runtime_policy::Policy::hip,
146-
axom::execution_space<axom::HIP_EXEC<256>>::allocatorID()}
144+
policy == axom::runtime_policy::Policy::hip
145+
? axom::execution_space<axom::HIP_EXEC<256>>::allocatorID()
146+
:
147147
#endif
148-
};
149-
150-
/// \brief Return default allocator id for a runtime policy.
151-
inline int policyToDefaultAllocatorID(axom::runtime_policy::Policy policy)
152-
{
153-
return s_policyToDefaultAllocatorID.find(policy)->second;
148+
axom::execution_space<axom::SEQ_EXEC>::allocatorID();
154149
}
155150

156151
} // namespace axom

0 commit comments

Comments
 (0)