mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-29 01:20:02 +02:00
trying to find memory leak, deleted pointers etc
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@629 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
e8e2c7b3e4
commit
cf30612701
@ -93,7 +93,15 @@ enum communicationProtocol{
|
||||
|
||||
genericSocket(const char* const host_ip_or_name, unsigned short int const port_number, communicationProtocol p, int ps = DEFAULT_PACKET_SIZE, int t = DEFAULT_PACKETS_PER_FRAME) :
|
||||
// portno(port_number),
|
||||
protocol(p), is_a_server(0), socketDescriptor(-1),file_des(-1), packet_size(ps),packets_per_frame(t)// sender (client): where to? ip
|
||||
protocol(p),
|
||||
is_a_server(0),
|
||||
socketDescriptor(-1),
|
||||
file_des(-1),
|
||||
packet_size(ps),
|
||||
nsending(0),
|
||||
nsent(0),
|
||||
total_sent(0),
|
||||
packets_per_frame(t)// sender (client): where to? ip
|
||||
{
|
||||
|
||||
// strcpy(hostname,host_ip_or_name);
|
||||
@ -142,7 +150,16 @@ protocol(p), is_a_server(0), socketDescriptor(-1),file_des(-1), packet_size(ps),
|
||||
|
||||
genericSocket(unsigned short int const port_number, communicationProtocol p, int ps = DEFAULT_PACKET_SIZE, int t = DEFAULT_PACKETS_PER_FRAME, const char *eth=NULL):
|
||||
//portno(port_number),
|
||||
protocol(p), is_a_server(1),socketDescriptor(-1), file_des(-1), packet_size(ps), packets_per_frame(t){
|
||||
protocol(p),
|
||||
is_a_server(1),
|
||||
socketDescriptor(-1),
|
||||
file_des(-1),
|
||||
packet_size(ps),
|
||||
nsending(0),
|
||||
nsent(0),
|
||||
total_sent(0),
|
||||
packets_per_frame(t)
|
||||
{
|
||||
|
||||
/* // you can specify an IP address: */
|
||||
/* */
|
||||
|
@ -1517,7 +1517,21 @@ int stopStateMachine(){
|
||||
#endif
|
||||
bus_w16(CONTROL_REG, STOP_ACQ_BIT);
|
||||
bus_w16(CONTROL_REG, 0x0);
|
||||
usleep(500);
|
||||
/*
|
||||
int i;
|
||||
for(i=0;i<10;i++){
|
||||
if(!(bus_r(STATUS_REG)&RUNMACHINE_BUSY_BIT)){
|
||||
printf("stoppped\n");
|
||||
break;
|
||||
}else{
|
||||
usleep(5000);
|
||||
printf("trying to stop again\n");
|
||||
bus_w16(CONTROL_REG, STOP_ACQ_BIT);
|
||||
bus_w16(CONTROL_REG, 0x0);
|
||||
}
|
||||
}
|
||||
*/
|
||||
usleep(5000);
|
||||
// if (!runBusy())
|
||||
if(!(bus_r(STATUS_REG)&RUNMACHINE_BUSY_BIT))
|
||||
return OK;
|
||||
|
@ -108,6 +108,18 @@ slsReceiverFunctionList::slsReceiverFunctionList(detectorType det,bool moenchwit
|
||||
|
||||
|
||||
|
||||
slsReceiverFunctionList::~slsReceiverFunctionList(){
|
||||
if(latestData) delete [] latestData;
|
||||
if(fifofree) delete [] fifofree;
|
||||
if(fifo) delete [] fifo;
|
||||
if(guiFileName) delete [] guiFileName;
|
||||
if(eth) delete [] eth;
|
||||
if(mem0) free(mem0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int slsReceiverFunctionList::setEnableFileWrite(int i){
|
||||
if(i!=-1)
|
||||
enableFileWrite=i;
|
||||
@ -322,6 +334,10 @@ int slsReceiverFunctionList::startListening(){
|
||||
if (strchr(eth,'.')!=NULL) strcpy(eth,"");
|
||||
if(!strlen(eth)){
|
||||
cout<<"warning:eth is empty.listening to all"<<endl;
|
||||
if(udpSocket){
|
||||
delete udpSocket;
|
||||
udpSocket = NULL;
|
||||
}
|
||||
udpSocket = new genericSocket(server_port,genericSocket::UDP,bufferSize/packetsPerFrame,packetsPerFrame);
|
||||
}else{
|
||||
cout<<"eth:"<<eth<<endl;
|
||||
@ -390,7 +406,6 @@ int slsReceiverFunctionList::startListening(){
|
||||
//Close down any open socket descriptors
|
||||
udpSocket->Disconnect();
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "listening_thread_running:" << listening_thread_running << endl;
|
||||
#endif
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~slsReceiverFunctionList(){ if(latestData) delete latestData;};
|
||||
virtual ~slsReceiverFunctionList();
|
||||
|
||||
/**
|
||||
* Set UDP Port Number
|
||||
|
@ -267,7 +267,6 @@ int slsReceiverFuncs::function_table(){
|
||||
flist[F_GET_FRAME_INDEX] = &slsReceiverFuncs::get_frame_index;
|
||||
flist[F_RESET_FRAMES_CAUGHT] = &slsReceiverFuncs::reset_frames_caught;
|
||||
flist[F_READ_FRAME] = &slsReceiverFuncs::read_frame;
|
||||
flist[F_READ_ALL] = &slsReceiverFuncs::read_all;
|
||||
flist[F_READ_RECEIVER_FREQUENCY]= &slsReceiverFuncs::set_read_frequency;
|
||||
flist[F_ENABLE_FILE_WRITE] = &slsReceiverFuncs::enable_file_write;
|
||||
flist[F_GET_ID] = &slsReceiverFuncs::get_version;
|
||||
@ -922,8 +921,6 @@ int slsReceiverFuncs::moench_read_frame(){
|
||||
|
||||
|
||||
int bufferSize = MOENCH_BUFFER_SIZE;
|
||||
char* raw = new char[bufferSize];
|
||||
|
||||
int rnel = bufferSize/(sizeof(int));
|
||||
int* retval = new int[rnel];
|
||||
int* origVal = new int[rnel];
|
||||
@ -931,6 +928,7 @@ int slsReceiverFuncs::moench_read_frame(){
|
||||
for(i=0;i<rnel;i++) retval[i]=0;
|
||||
for(i=0;i<rnel;i++) origVal[i]=0;
|
||||
|
||||
char* raw = new char[bufferSize];
|
||||
|
||||
uint32_t startIndex=0;
|
||||
int index = 0;
|
||||
@ -1100,9 +1098,9 @@ int slsReceiverFuncs::moench_read_frame(){
|
||||
//return ok/fail
|
||||
|
||||
|
||||
delete [] origVal;
|
||||
delete [] retval;
|
||||
|
||||
delete [] origVal;
|
||||
delete [] raw;
|
||||
|
||||
return ret;
|
||||
|
||||
@ -1118,7 +1116,8 @@ int slsReceiverFuncs::gotthard_read_frame(){
|
||||
|
||||
|
||||
//retval is a full frame
|
||||
int rnel = GOTTHARD_BUFFER_SIZE/(sizeof(int));
|
||||
int bufferSize = GOTTHARD_BUFFER_SIZE;
|
||||
int rnel = bufferSize/(sizeof(int));
|
||||
int* retval = new int[rnel];
|
||||
int* origVal = new int[rnel];
|
||||
//all initialized to 0
|
||||
@ -1131,14 +1130,11 @@ int slsReceiverFuncs::gotthard_read_frame(){
|
||||
|
||||
|
||||
//depending on shortframe or not
|
||||
int bufferSize = GOTTHARD_BUFFER_SIZE;
|
||||
if(shortFrame!=-1)
|
||||
bufferSize=GOTTHARD_SHORT_BUFFER_SIZE;
|
||||
char* raw = new char[bufferSize];
|
||||
|
||||
|
||||
//int* emptys = new int[rnel]();
|
||||
|
||||
uint32_t index=0,index2=0;
|
||||
uint32_t startIndex=0;
|
||||
int count=0;
|
||||
@ -1230,6 +1226,7 @@ int slsReceiverFuncs::gotthard_read_frame(){
|
||||
|
||||
delete [] retval;
|
||||
delete [] origVal;
|
||||
delete [] raw;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1285,13 +1282,6 @@ int slsReceiverFuncs::set_read_frequency(){
|
||||
|
||||
|
||||
|
||||
/**needs to be implemented */
|
||||
int slsReceiverFuncs::read_all(){
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int slsReceiverFuncs::enable_file_write(){
|
||||
|
@ -137,9 +137,6 @@ public:
|
||||
/** Sets the receiver to send every nth frame to gui, or only upon gui request */
|
||||
int set_read_frequency();
|
||||
|
||||
/** Reads every nth frame, sends them to gui without closing socket */
|
||||
int read_all();
|
||||
|
||||
/** Enable File Write*/
|
||||
int enable_file_write();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user