示例#1
0
文件: memory.c 项目: donizyo/Cruiser
extern void *
trimMemory(void *mem)
{
    int len;
    void *res;
    
    len = strlen((char *) mem);
    res = allocMemory(len + 1, sizeof (u1));
    if (!res)
        return (void *) 0;
    memcpy(res, mem, len);
    freeMemory(mem);
    
    return res;
}
void loop()
{
      USB.println("\ndevice enters loop\n");
      USB.println(RTC.getTime());
      USB.println(freeMemory());
      
      
/*
      USB.print("\nTimeRTC: ");
      USB.println(RTC.getTime());


      //xbeeZB.printSensorMask(xbeeZB.activeSensorMask);

      xbeeZB.createAndSaveNewTime2SleepArray(sortedTimes);
      USB.print("FreeMem"); USB.println(freeMemory());
      
      er = SensUtils.measureSensors(xbeeZB.activeSensorMask);
      if( er!= 0)
      {
         USB.print("ERROR SensUtils.measureSensors(uint16_t *) returns: ");
         USB.println(er);
      }
      
      USB.print("\nEndMeasuring, start check association\n");    
      er = COMM.checkNodeAssociation(LOOP);
      if( er!= 0)
      {
         USB.print("ERROR COMM.checkNodeAssociation(LOOP) returns: ");
         USB.println(er);
      }     
      
      USB.print("\nEndassociation\n");
      er = PackUtils.sendMeasuredSensors(dest, xbeeZB.activeSensorMask);
      if( er!= 0)
      {
           USB.print("ERROR PAQ.sendMeasuredSensors(uint16_t *) returns: ");
           USB.println(er); 
      }
      
      USB.print("\ntime at hibernate"); USB.println(RTC.getTime());
*/

      ////////////////////////////////////////////////
      // 6. Entering hibernate mode
      ////////////////////////////////////////////////
      xbeeZB.enterLowPowerMode(HIBERNATE);
}
示例#3
0
文件: RRTstar.cpp 项目: arjungm/ompl
void ompl::geometric::RRTstar::clear()
{
    Planner::clear();
    sampler_.reset();
    freeMemory();
    if (nn_)
        nn_->clear();

    lastGoalMotion_ = NULL;
    goalMotions_.clear();

    iterations_ = 0;
    collisionChecks_ = 0;
    bestCost_ = base::Cost(std::numeric_limits<double>::quiet_NaN());

}
Matrix<elType>& Matrix<elType>::set(const Matrix &m)
{
	freeMemory();
	if (m.getWidth()!=0 && m.getWidth() !=0)
	{
		create(m.getWidth(),m.getHeight());
		memcpy(pData,m.get(),m.getWidth()*m.getHeight()*sizeof(elType));
	} 
	else
	{
		pData = NULL;
		width = m.getWidth();
		height = m.getHeight();
	}
	return *this;
}
示例#5
0
文件: TRRT.cpp 项目: jvgomez/ompl
void ompl::geometric::TRRT::clear()
{
    Planner::clear();
    sampler_.reset();
    freeMemory();
    if (nearestNeighbors_)
        nearestNeighbors_->clear();
    lastGoalMotion_ = nullptr;

    // Clear TRRT specific variables ---------------------------------------------------------
    temp_ = initTemperature_;
    nonfrontierCount_ = 1;
    frontierCount_ = 1;  // init to 1 to prevent division by zero error
    if (opt_)
        bestCost_ = worstCost_ = opt_->identityCost();
}
示例#6
0
文件: RRTXstatic.cpp 项目: ompl/ompl
void ompl::geometric::RRTXstatic::clear()
{
    setup_ = false;
    Planner::clear();
    sampler_.reset();
    infSampler_.reset();
    freeMemory();
    if (nn_)
        nn_->clear();

    lastGoalMotion_ = nullptr;
    goalMotions_.clear();

    iterations_ = 0;
    bestCost_ = base::Cost(std::numeric_limits<double>::quiet_NaN());
}
示例#7
0
文件: SBL.cpp 项目: ompl/ompl
void ompl::geometric::SBL::clear()
{
    Planner::clear();

    sampler_.reset();

    freeMemory();

    tStart_.grid.clear();
    tStart_.size = 0;
    tStart_.pdf.clear();

    tGoal_.grid.clear();
    tGoal_.size = 0;
    tGoal_.pdf.clear();
    connectionPoint_ = std::make_pair<base::State *, base::State *>(nullptr, nullptr);
}
示例#8
0
void ompl::geometric::BiTRRT::clear()
{
    Planner::clear();
    freeMemory();
    if (tStart_)
        tStart_->clear();
    if (tGoal_)
        tGoal_->clear();
    connectionPoint_ = std::make_pair<Motion*, Motion*>(NULL, NULL);

    // TRRT specific variables
    temp_ = initTemperature_;
    nonfrontierCount_ = 1;
    frontierCount_ = 1; // init to 1 to prevent division by zero error
    if (opt_)
        bestCost_ = worstCost_ = opt_->identityCost();
}
示例#9
0
int main(int argc, char **argv) {
	MAP* map = newMap();
	char *strFrank = "frank";
	char *strJef = "jef";
	char *strDirk = "dirk";
	put(map, strFrank, "0486/11.33.23");
	put(map, strJef, "0486/10.20.30");
	put(map, strDirk, "0475/11.39.12");
	printMap(map);
	printf("Nummer van frank: %s\n",get(map, strFrank));
	printf("Jef verwijderen...\n");
	removePair(map, strJef);
	removePair(map, "bla");
	printMap(map);
	freeMemory(map);
	return 0;
}
示例#10
0
int 
main(int argc, char ** argv) 
{

	printf ("c Pseudoflow algorithm for parametric min cut (version 1.0)\n");
	readDimacsFileCreateList ();

#ifdef PROGRESS
	printf ("c Finished reading file.\n"); fflush (stdout);
#endif

	simpleInitialization ();

#ifdef PROGRESS
	printf ("c Finished initialization.\n"); fflush (stdout);
#endif

	pseudoflowPhase1 ();

#ifdef PROGRESS
	printf ("c Finished phase 1.\n"); fflush (stdout);
#endif

#ifdef RECOVER_FLOW
	recoverFlow();
	checkOptimality ();
#endif

	printf ("c Number of nodes     : %d\n", numNodes);
	printf ("c Number of arcs      : %d\n", numArcs);
#ifdef STATS
	printf ("c Number of arc scans : %lld\n", numArcScans);
	printf ("c Number of mergers   : %d\n", numMergers);
	printf ("c Number of pushes    : %lld\n", numPushes);
	printf ("c Number of relabels  : %d\n", numRelabels);
	printf ("c Number of gaps      : %d\n", numGaps);
#endif

#ifdef BREAKPOINTS
	displayBreakpoints ();
#endif

	freeMemory ();

	return 0;
}
void setup()
{
      USB.begin();
      USB.print("usb started, ");  USB.print(FM);   USB.println(freeMemory());
      
      xbeeZB.printStoredErrors();
  
      if( COMM.setupXBee(panID, ROUTER, gateway, NONE, "NodeD", 6, HIGHPERFORMANCE) ) 
          USB.println("\nERROR SETTING UP XBEE MODULE\n");        //ALSO_SAVED_IN_EEPROM
          
      ///////////////////////////////////////////////////////////////////////////////////////
      // FOR TESTING PURPOSES ONLY:  Overrides the inNetwork boolean!          
      xbeeZB.setActiveSensorMaskWithTimes(6, TEMPERATURE, 6, HUMIDITY, 12, BATTERY, 18);   
      xbeeZB.posInArray = 0;
      xbeeZB.setAlarmForRouter(); 
      ///////////////////////////////////////////////////////////////////////////////////////        
}
示例#12
0
int main(int argc, char *argv[]){

	if(argc != 2){
		printf("%s", "ERR \"numero de parametros incorreto\"\n"
				"<< Deve-se usar: nomedoPrograma nomeArquivoCodigofonte\n");
	}else{

		if( lAnalyzer(argv[1]) )
			sAnalyzer();

		freeMemory();

	}

	//TODO verifying how the operational system empty memory after exit program or before
	return 0;
}
示例#13
0
bool heartbeatDebug (Debuf *de)
{
    bool action = false ;

    if (clock_time() > de->next_)
    {
		printf ("-------------------------------------------------------------------") ;
		printf ("%s free mem = ",B_BLUE ("loop ")) ;
		DBG1 (freeMemory ()) ;
		printf("\n");

		de->next_ += de->interv_ ;
		action = true ;
    }

    return action ;
}
示例#14
0
HRESULT CMfxEvent::SetSysxData( BYTE* pbData, DWORD dwLen )
{
	ASSERT( GetType() == Sysx );

	// Free the old buffer
	freeMemory();

	// Allocate the new buffer
	CHECK( theBufferFactory.Create( dwLen, &m_hBuffer ) );

	// Copy in the data
	void*	pv;
	DWORD	cb;
	CHECK( theBufferFactory.GetPointer( m_hBuffer, &pv, &cb ) );
	ASSERT( cb == dwLen );
	memcpy( pv, pbData, dwLen );
	return S_OK;
}
int main(void)
{
    
    unsigned short  *stageLights, *overLayPattern;
    int             *startBit, *numBits;
    
    stageLights    = (unsigned short*)Malloc(sizeof(unsigned short));
    overLayPattern = (unsigned short*)Malloc(sizeof(unsigned short));
    startBit       = (int *)Malloc(sizeof(int));
    numBits        = (int *)Malloc(sizeof(int));
    
    printMenu();
    getUserOption(&stageLights, &overLayPattern, startBit, numBits);
    freeMemory(stageLights, overLayPattern, startBit, numBits);
    
    
    return 0;
}
示例#16
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int main(int argc, char **argv)
{

  if (argc != 2)
  {
    std::cout << "Nees 1 argument which is an output filename." << std::endl;
  }

  std::string outputFile(argv[1]);
  size_t width = Detail::TRI_WIDTH;
  size_t height = Detail::TRI_HEIGHT;

  unsigned char* image = createTriangle(width, height);
  int err = writeOutputAsTiff(image, width, height, outputFile, std::string("Crystal Orientation Color Legend"));
  freeMemory(image);

  return err;
}
示例#17
0
void MovingPeak::changeNumPeaks(){

	MovingPeak* mpb=new MovingPeak(Global::msm_pro["DYN_CONT_MovingPeak"],m_numDim,m_numPeaksTemp,m_changePeakRatio,m_flagDimensionChange
		,m_flagNumPeaksChange,m_numPeaksChangeMode,m_noiseFlag,m_timeLinkageFlag);

	mpb->parameterSetting(this);
	mpb->calculateGlobalOptima();

	freeMemory();
	DynamicContinuous::freeMemory();

	allocateMemory(m_numDim,m_numPeaksTemp);
    DynamicContinuous::allocateMemory(m_numDim,m_numPeaksTemp);
    m_numPeaks=m_numPeaksTemp;
	*this=*mpb;
	delete mpb;
	mpb=0;
}
示例#18
0
void AP_Autopilot::callback2(void * data) {
    AP_Autopilot * apo = (AP_Autopilot *) data;
    //apo->getBoard()->debug->println_P(PSTR("callback 2"));

    /*
     * send telemetry
     */
    if (apo->getBoard()->gcs) {
        // send messages
        //apo->getBoard()->gcs->sendMessage(MAVLINK_MSG_ID_GPS_RAW_INT);
        //apo->getBoard()->gcs->sendMessage(MAVLINK_MSG_ID_LOCAL_POSITION);
        apo->getBoard()->gcs->sendMessage(MAVLINK_MSG_ID_RC_CHANNELS_SCALED);
        apo->getBoard()->gcs->sendMessage(MAVLINK_MSG_ID_RC_CHANNELS_RAW);
        apo->getBoard()->gcs->sendMessage(MAVLINK_MSG_ID_SCALED_IMU);
    }

    /*
     * update battery monitor
     */
    if (apo->getBoard()->batteryMonitor) apo->getBoard()->batteryMonitor->update();

    /*
     * send heartbeat
     */
    apo->getBoard()->gcs->sendMessage(MAVLINK_MSG_ID_HEARTBEAT);

    /*
     * load/loop rate/ram debug
     */
    apo->getBoard()->load = apo->load();
    apo->getBoard()->debug->printf_P(PSTR("callback calls: %d\n"),apo->callbackCalls);
    apo->callbackCalls = 0;
    apo->getBoard()->debug->printf_P(PSTR("load: %d%%\trate: %f Hz\tfree ram: %d bytes\n"),
                                   apo->load(),1.0/apo->dt(),freeMemory());
    apo->getBoard()->gcs->sendMessage(MAVLINK_MSG_ID_SYS_STATUS);

    /*
     * adc debug
     */
    //apo->getDebug().printf_P(PSTR("adc: %d %d %d %d %d %d %d %d\n"),
    //apo->adc()->Ch(0), apo->adc()->Ch(1), apo->adc()->Ch(2),
    //apo->adc()->Ch(3), apo->adc()->Ch(4), apo->adc()->Ch(5),
    //apo->adc()->Ch(6), apo->adc()->Ch(7), apo->adc()->Ch(8));
}
示例#19
0
	//-----------------------------------------------------------------------------
	Image& Image::loadDynamicImage( uchar* pData, size_t uWidth, size_t uHeight, 
		size_t depth,
		PixelFormat eFormat, bool autoDelete, 
		size_t numFaces, size_t numMipMaps)
	{

		freeMemory();
		// Set image metadata
		m_uWidth = uWidth;
		m_uHeight = uHeight;
		m_uDepth = depth;
		m_eFormat = eFormat;
		m_ucPixelSize = static_cast<uchar>(PixelUtil::getNumElemBytes( m_eFormat ));
		m_uNumMipmaps = numMipMaps;
		m_uFlags = 0;
		// Set flags
		if (PixelUtil::isCompressed(eFormat))
			m_uFlags |= IF_COMPRESSED;
		if (m_uDepth != 1)
			m_uFlags |= IF_3D_TEXTURE;
		if(numFaces == 6)
			m_uFlags |= IF_CUBEMAP;
		if(numFaces != 6 && numFaces != 1)
			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
			"Number of faces currently must be 6 or 1.", 
			"Image::loadDynamicImage");

		m_uSize = calculateSize(numMipMaps, numFaces, uWidth, uHeight, depth, eFormat);

        if (pData)
        {
            m_pBuffer = pData;
            m_bAutoDelete = autoDelete;
        }
        else
        {
            m_bAutoDelete = true;
            m_pBuffer = OGRE_ALLOC_T(Ogre::uchar, m_uSize, Ogre::MEMCATEGORY_RESOURCE);
        }


		return *this;

	}
示例#20
0
文件: Bitmap.cpp 项目: carussell/nvvg
/// \param filename Specifies the name of the file.
/// \param returnErrMsg Must point to a valid character buffer to be filled
///     with an error message in the event of failure.
/// \return true iff successful, else false.
/// \warning This function is currently unsafe, as there is no guarantee that
///     the given error message buffer will be large enough to accomodate the
///     error message.  Recommend changing to use string instead.
bool	Bitmap::load(const char *filename, char *returnErrMsg,size_t errMsgSize) {

	// Free up anything already allocated

	freeMemory();

	// Fetch extension.  I wish I could use the _splitpath function,
	// but it's not cross-platform.  I'll parse the thing myself.

	const char *ext = strchr(filename, '.');
	if (ext == NULL) {
		//SECURITY-UPDATE:2/4/07
		//strcpy(returnErrMsg, "Filename has no extension");
		strcpy_s(returnErrMsg,errMsgSize, "Filename has no extension");
		return false;
	}
	for (;;) {
		const char *dot = strchr(ext+1, '.');
		if (dot == NULL) {
			break;
		}
		ext = dot;
	}

	// Check for known extensions

	if (_stricmp(ext, ".tga") == 0) {
		//SECURITY-UPDATE:2/4/07
		//return loadTGA(filename, returnErrMsg);
		return loadTGA(filename, returnErrMsg,errMsgSize);
	}
	if (_stricmp(ext, ".bmp") == 0) {
		//SECURITY-UPDATE:2/4/07
		//return loadBMP(filename, returnErrMsg);
		return loadBMP(filename, returnErrMsg,errMsgSize);
	}

	// Unknown extension
	//SECURITY-UPDATE:2/4/07
	//sprintf(returnErrMsg, "Unknown/unsupported file extension '%s'", ext);
	sprintf_s(returnErrMsg,errMsgSize, "Unknown/unsupported file extension '%s'", ext);
	return false;
}
示例#21
0
文件: pSBL.cpp 项目: giogadi/ompl
void ompl::geometric::pSBL::clear(void)
{
    Planner::clear();

    samplerArray_.clear();

    freeMemory();

    tStart_.grid.clear();
    tStart_.size = 0;
    tStart_.pdf.clear();

    tGoal_.grid.clear();
    tGoal_.size = 0;
    tGoal_.pdf.clear();

    removeList_.motions.clear();
    connectionPoint_ = std::make_pair<base::State*, base::State*>(NULL, NULL);
}
示例#22
0
char *GetFormattedCacheType(Waypoint_Info *wpi)
{
	char *formattedType = NULL;
	int i;

	AppendStringN(&formattedType, &(wpi->WaypointXML[wpi->type2_off]),
			wpi->type2_len);

	if (formattedType == NULL) 
	{
		AppendStringN(&formattedType, &(wpi->WaypointXML[wpi->type_off]),
			wpi->type_len);
	}

	if (formattedType == NULL) {
		AppendString(&formattedType, "No_Type");
		return formattedType;
	}

	i = 0;
	while (formattedType[i] != ' ' && formattedType[i] != '-' &&
			formattedType[i] != '\0')
	{
		if (formattedType[i] == '|') {
			formattedType[i] = '_';
		}
		i ++;
	}
	formattedType[i] = '\0';

	if (strcmp(formattedType, "Cache") == 0)
	{
		freeMemory((void **) &formattedType);
		AppendString(&formattedType, "CITO_Event");
	}
	else if (strcmp(formattedType, "Letterbox") == 0 ||
			strcmp(formattedType, "Project") == 0)
	{
		formattedType[i] = '_';
	}

	return formattedType;
}
示例#23
0
void perceptron::load(const perceptron *p)
{
	if (p && ((p->inputs != inputs) || (p->outputs != outputs)))
	{
		freeMemory();
		inputs = p->inputs;
		outputs = p->outputs;
		outputActivation = p->outputActivation;

		allocateMemory();
	}
	for (int y = 0; y < outputs; y++)
	{
		for (int x = 0; x <= inputs; x++)
		{
			weight[y][x] = p->weight[y][x];
		}
	}
}
示例#24
0
static void ServeFile(FILE * stream_file, const char * fname, SdFile & theFile, EthernetClient & client)
{
	freeMemory();
	const char * ext;
	for (ext=fname + strlen(fname); ext>fname; ext--)
		if (*ext == '.')
		{
			ext++;
			break;
		}
	if (ext > fname)
	{
		if (strcmp(ext, "jpg") == 0)
			ServeHeader(stream_file, 200, "OK", true, "image/jpeg");
		else if (strcmp(ext, "gif") == 0)
			ServeHeader(stream_file, 200, "OK", true, "image/gif");
		else if (strcmp(ext, "css") == 0)
			ServeHeader(stream_file, 200, "OK", true, "text/css");
		else if (strcmp(ext, "js") == 0)
			ServeHeader(stream_file, 200, "OK", true, "application/javascript");
		else if (strcmp(ext, "ico") == 0)
			ServeHeader(stream_file, 200, "OK", true, "image/x-icon");
		else
			ServeHeader(stream_file, 200, "OK", true);
	}
	else
		ServeHeader(stream_file, 200, "OK", true);


#ifdef ARDUINO
	flush_sendbuf(client);
#else
	fflush(stream_file);
#endif
	while (theFile.available())
	{
		int bytes = theFile.read(sendbuf, 512);
		if (bytes <= 0)
			break;
		client.write((uint8_t*) sendbuf, bytes);
	}
}
示例#25
0
static void ServeSchedPage(FILE * stream_file)
{
	Schedule sched;
	freeMemory();
	ServeHeader(stream_file, 200, "OK", false);
	const uint8_t numSched = GetNumSchedules();
	for (uint8_t iSchedNum = 0; iSchedNum < numSched; iSchedNum++)
	{
		LoadSchedule(iSchedNum, &sched);
		fprintf_P(stream_file, PSTR("<hr/>Schedule #%d<br/>"), iSchedNum);
		if (sched.IsEnabled())
			fprintf_P(stream_file, PSTR("Enabled"));
		else
			fprintf_P(stream_file, PSTR("Not Enabled"));
		fprintf_P(stream_file, PSTR("<br/>Name:%s<br/>"), sched.name);
		if (sched.IsInterval())
			fprintf_P(stream_file, PSTR("Interval : %d"), sched.interval);
		else
		{
			fprintf_P(stream_file, PSTR("Day :"));
			if (sched.day & 0x01)
				fprintf(stream_file, "Su");
			if (sched.day & 0x02)
				fprintf(stream_file, "M");
			if (sched.day & 0x04)
				fprintf(stream_file, "T");
			if (sched.day & 0x08)
				fprintf(stream_file, "W");
			if (sched.day & 0x10)
				fprintf(stream_file, "R");
			if (sched.day & 0x20)
				fprintf(stream_file, "F");
			if (sched.day & 0x40)
				fprintf(stream_file, "Sa");
			fprintf_P(stream_file, PSTR("(%d)"), sched.day);
		}
		for (uint8_t i = 0; i < 4; i++)
			fprintf_P(stream_file, PSTR("<br/>Time %d:%02d:%02d(%d)"), i + 1, sched.time[i] / 60, sched.time[i] % 60, sched.time[i]);
		for (uint8_t i = 0; i < NUM_ZONES; i++)
			fprintf_P(stream_file, PSTR("<br/>Zone %d Duration:%d"), i + 1, sched.zone_duration[i]);
	}
}
示例#26
0
    void Good::name (const char*  value) {
        // Finding the real length of the value
        int stringLength = 0;
        int stringMaxLength = 2000;

        for (stringLength = 0; stringLength < stringMaxLength && value [stringLength] != '\0'; stringLength++);

        if (stringLength < 1) stringLength = 1;

        // Deleting any dynamic memory already set
        freeMemory ();

        // Creating a dynamic memory with the correct size
        _name = new char [stringLength + 1];

        // Copying the value to the dynamic memory and finalizing it
        // with a null terminator
        strcpy (_name,value);
        _name [stringLength] = '\0';
    }
示例#27
0
void ompl::control::PathControl::random(void)
{
    freeMemory();
    states_.resize(2);
    controlDurations_.resize(1);
    controls_.resize(1);

    const SpaceInformation *si = static_cast<const SpaceInformation*>(si_.get());
    states_[0] = si->allocState();
    states_[1] = si->allocState();
    controls_[0] = si->allocControl();

    base::StateSamplerPtr ss = si->allocStateSampler();
    ss->sampleUniform(states_[0]);
    ControlSamplerPtr cs = si->allocControlSampler();
    cs->sample(controls_[0], states_[0]);
    unsigned int steps = cs->sampleStepCount(si->getMinControlDuration(), si->getMaxControlDuration());
    controlDurations_[0] = steps * si->getPropagationStepSize();
    si->propagate(states_[0], controls_[0], steps, states_[1]);
}
示例#28
0
CmdManager::CmdManager(unsigned int _serialPort,
                       unsigned long _commBaudRate)
{
    this->m_BatchProcessing = true;
    this->m_ProcessQueue = false;
    
    this->m_SerialPort = _serialPort;
    this->m_ComBaudRate = _commBaudRate;
    this->StartStream(this->m_SerialPort, this->m_ComBaudRate);
    
    this->m_AvailableCommands = (freeMemory()-2048)/sizeof(CmdMessage);
    this->m_NextFreeQueuePosition = 0;
    
    this->m_MessageQueue = (CmdMessage*) malloc(this->m_AvailableCommands *
                                                sizeof(CmdMessage));
    this->m_CurrentQueueLength = 0;
    this->m_TotalQueueLength = this->m_AvailableCommands;
    
    this->m_CmdMessageSize = sizeof(CmdMessage);
}
/* -------------------------------------------------------------------------- */
int
sendPacket(data_store_t *ds, size_t *response_size, unsigned char **response)
{
  if(simple_memory_buffer_get_size(ds, response_size) != ERROR_OK)
    return ERROR_UNKNOWN;

  /* request memory for response */ 
  if(requestMemory((void**)response, *response_size + 1) != ERROR_OK)
    return ERROR_MEMORY;
  
  unsigned char *buffer = NULL;
  if(simple_memory_buffer_get_data(ds, &buffer) != ERROR_OK){
    freeMemory(*response);
    return ERROR_UNKNOWN;
  }

  memcpy(*response, buffer, *response_size);
  (*response)[*response_size] = '\0';
  return ERROR_OK;
}
/** 
 * @brief Allocate enough memory for at least maxChips and
 * maxProbes.
 * 
 * @param maxChips - Number of chips that can be computed.
 * @param maxProbes - Number of probes or features that can be computed.
 */
void QuantIterPlier::allocMemory(unsigned int maxChips, unsigned int maxProbes) {
  // fre what we have.
  freeMemory();

  m_MaxChips = maxChips;
  m_MaxProbes = maxProbes;

  m_ProbeEffects = new double[m_MaxProbes];
  m_ProbesUsed = new  int[m_MaxProbes];
  m_ChipEffects = new double[m_MaxChips];

  m_PM = new double *[m_MaxChips];
  m_MM = new double *[m_MaxChips];
  m_Residuals = new double *[m_MaxChips];
  for(unsigned int i = 0; i < m_MaxChips; i++) {
    m_PM[i] = new double[m_MaxProbes];
    m_MM[i] = new double[m_MaxProbes];
    m_Residuals[i] = new double[m_MaxProbes];
  }
}