mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 15:00:02 +02:00
memset of the entire memory in the beginning, cuz mpc2012 shows leak at runtime
This commit is contained in:
parent
0e2d0f07e8
commit
06d60c981d
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int Fifo::NumberofFifoClassObjects(0);
|
int Fifo::NumberofFifoClassObjects(0);
|
||||||
@ -46,6 +47,7 @@ int Fifo::CreateFifos(uint32_t fifoItemSize, uint32_t fifoDepth) {
|
|||||||
fifoStream = new CircularFifo<char>(fifoDepth);
|
fifoStream = new CircularFifo<char>(fifoDepth);
|
||||||
//allocate memory
|
//allocate memory
|
||||||
memory = (char*) calloc (fifoItemSize * fifoDepth, sizeof(char));
|
memory = (char*) calloc (fifoItemSize * fifoDepth, sizeof(char));
|
||||||
|
memset(memory,0,fifoItemSize * fifoDepth* sizeof(char));
|
||||||
if (memory == NULL){
|
if (memory == NULL){
|
||||||
FILE_LOG (logERROR) << "Could not allocate memory for fifos";
|
FILE_LOG (logERROR) << "Could not allocate memory for fifos";
|
||||||
memory = 0;
|
memory = 0;
|
||||||
@ -55,7 +57,7 @@ int Fifo::CreateFifos(uint32_t fifoItemSize, uint32_t fifoDepth) {
|
|||||||
{ //push free addresses into fifoFree fifo
|
{ //push free addresses into fifoFree fifo
|
||||||
char* buffer = memory;
|
char* buffer = memory;
|
||||||
while (buffer < (memory + fifoItemSize * (fifoDepth-1))) {
|
while (buffer < (memory + fifoItemSize * (fifoDepth-1))) {
|
||||||
sprintf(buffer,"memory");
|
//sprintf(buffer,"memory");
|
||||||
#ifdef FIFODEBUG
|
#ifdef FIFODEBUG
|
||||||
cprintf(MAGENTA,"Fifofree %d: value:%d, pop 0x%p\n", index, fifoFree->getSemValue(), (void*)(buffer));
|
cprintf(MAGENTA,"Fifofree %d: value:%d, pop 0x%p\n", index, fifoFree->getSemValue(), (void*)(buffer));
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user