Skip to content
Snippets Groups Projects
Commit 89203ce3 authored by John Romein's avatar John Romein
Browse files

bug 225:

Initialize (padded) memory blocks in case valgrind is used.
parent 2b9adcec
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,7 @@
#include <Interface/PencilCoordinates.h>
#include <Interface/Parset.h>
#include <cstring>
#include <vector>
#include <string>
......@@ -38,7 +39,7 @@ namespace RTCP {
class CN_Configuration
{
public:
CN_Configuration() {}
CN_Configuration();
#if !defined HAVE_BGP_CN
CN_Configuration(const Parset &parset);
......
......@@ -30,6 +30,7 @@
#include <Common/LofarLogger.h>
#include <cassert>
#include <cstring>
namespace LOFAR {
......@@ -105,6 +106,9 @@ inline SubbandMetaData::SubbandMetaData(unsigned nrSubbands, unsigned nrBeams, s
itsMarshallData(static_cast<char*>(allocator.allocate(itsMarshallDataSize, alignment))),
itsAllocator(allocator)
{
#if defined HAVE_VALGRIND
memset(itsMarshallData, 0, itsMarshallDataSize);
#endif
}
inline SubbandMetaData::~SubbandMetaData()
......
......@@ -23,14 +23,28 @@
#include <Interface/CN_Configuration.h>
#include <cassert>
#include <cstring>
namespace LOFAR {
namespace RTCP {
CN_Configuration::CN_Configuration()
{
#if defined HAVE_VALGRIND
memset(&itsMarshalledData, 0, sizeof itsMarshalledData);
#endif
}
#if ! defined HAVE_BGP_CN
CN_Configuration::CN_Configuration(const Parset &parset)
{
#if defined HAVE_VALGRIND
memset(&itsMarshalledData, 0, sizeof itsMarshalledData);
#endif
nrStations() = parset.nrStations();
nrBitsPerSample() = parset.nrBitsPerSample();
nrSubbands() = parset.nrSubbands();
......
......@@ -2,6 +2,9 @@
#include <Interface/CN_Mode.h>
#include <cstring>
namespace LOFAR {
namespace RTCP {
......@@ -23,6 +26,10 @@ unsigned CN_Mode::nrModes()
CN_Mode::CN_Mode()
{
#if defined HAVE_VALGRIND
memset(&itsMarshalledData, 0, sizeof itsMarshalledData);
#endif
itsMarshalledData.mode = INVALID;
}
......@@ -33,6 +40,10 @@ CN_Mode::CN_Mode(const Parset &ps)
{
string name = ps.getModeName();
#if defined HAVE_VALGRIND
memset(&itsMarshalledData, 0, sizeof itsMarshalledData);
#endif
itsMarshalledData.mode = INVALID;
for (unsigned i = 0; i < nrModes(); i ++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment