Skip to content

Commit 50e3b86

Browse files
committed
use trivial deletor to avoid memcpy in pvxs converter
1 parent 5af4c34 commit 50e3b86

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ADApp/ntndArrayConverterSrc/ntndArrayConverterPvxs.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,11 @@ void NTNDArrayConverterPvxs::fromValue(NDArray *src) {
335335

336336
std::string fieldName = m_fieldNameMap[typeid(dataType)];
337337
auto arrayType = m_arrayTypeMap[typeid(dataType)];
338-
auto val = pvxs::allocArray(arrayType, arrayInfo.nElements);
339-
memcpy(val.data(), src->pData, arrayInfo.totalBytes);
338+
auto val = pvxs::shared_array<dataType>(
339+
(dataType*)src->pData,
340+
// trivial deletor that does nothing when shared_array goes out of scope
341+
[] (dataType *data) {},
342+
arrayInfo.nElements);
340343
m_value[fieldName] = val.freeze();
341344

342345
m_value["codec.name"] = src->codec.name; // compression codec

0 commit comments

Comments
 (0)