Change in osmo-trx[master]: SigProcLib: Improve Vector buffer allocation mess

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Wed Dec 5 11:06:09 UTC 2018


Hello Jenkins Builder, 

I'd like you to reexamine a change. Please visit

    https://gerrit.osmocom.org/12085

to look at the new patch set (#2).

Change subject: SigProcLib: Improve Vector buffer allocation mess
......................................................................

SigProcLib: Improve Vector buffer allocation mess

Original issue: In order to use SSE instructions, 16-byte aligned memory
chunks are needed, and C++ version < C++11 doesn't provide for a native
new/delete store. For that reason, memalign() must be used in the
implementation of convolve_h_alloc() for some buffers.
On the other side, The C++ code relies on C++ "new T[]" operator to
allocate a chunk of memory containing an array of class instances. As
classes are complex types, they cannot be allocated through C structures
(calling malloc). Experimentally can be seen too that it's unreliable
and the process will crash during startup if malloc() is used and then a
Complex<> deferred from it.

Previous implementation allowed for use of convolve_h_alloc or new[]
based on how the (signal)Vector is called, because then the buffer is
not going to be managed internally. But that's unreliable since resize()
calling resize() on it could use "delete" operator on a malloc'ed
buffer, and end up having a new new[] allocated buffer. It was also
found that some of the callers were actually leaking memory through ASan (because the
buffer is not managed by the Vector instance).

IMHO best option would be to rewrite all this code using C structures
and malloc/free exclusively, since it would make all this cod eeasier to
maintain.

But for now, let's extend the Vector class to allow specifying an
external alloc/free function and let the Vector instance take care of
the ownership of the buffer in all scenarios.

Change-Id: Ie484a4762a7f77fe1b105188ea03a6f025730b82
---
M CommonLibs/Vector.h
M Transceiver52M/arch/common/convolve.h
M Transceiver52M/arch/common/convolve_base.c
M Transceiver52M/sigProcLib.cpp
M Transceiver52M/signalVector.cpp
M Transceiver52M/signalVector.h
6 files changed, 52 insertions(+), 47 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/85/12085/2
-- 
To view, visit https://gerrit.osmocom.org/12085
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie484a4762a7f77fe1b105188ea03a6f025730b82
Gerrit-Change-Number: 12085
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-CC: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181205/42e0a943/attachment.htm>


More information about the gerrit-log mailing list