Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c++ stl vector causing memory overflow? -


i making extensive use of stl vectors manage memory (de-) allocation of large arrays of data. in particular generating perspective projections of anatomical structures large number of angles (180 in 2 degree steps), processing , analysing results. results used define radiation fields radiotherapy.

it seems if arrays exceed size (>3 anatomical structures) memory overflows. in particular error follows

terminate called after throwing instance of 'std::out_of_range' what(): vector::_m_range_check

this result of using at, bounds checking, rather faster [] operator. if have <=3 structures error not occur.

i have tracked error down following block of code

bool dicomcp::assignbeamlet(int beamletnumber, beamlet &b1) {  //std::cout << "\ninside dicomcp::assignbeamlet (int, beamlet &)\n";    if (!this->isset)   {    this->beamlets.at(beamletnumber).setleftright(b1.left,b1.right);     this->isset=true;     return true;     }    else if (!this->beamlets.at(beamletnumber-1).isopen())   {     return false;    }    // left (outside) min(left) , right (outside) max(right) leaves   else if ((this->beamlets.at(beamletnumber-1).right-b1.left >epsilon2)&&(b1.right-this->beamlets.at(beamletnumber-1).left>epsilon2))   {     if (this->beamlets.at(beamletnumber).open) return false;     else if (!this->beamlets.at(beamletnumber).open)    {    this->beamlets.at(beamletnumber).setleftright(b1.left,b1.right);    this->beamlets.at(beamletnumber).isassigned=true;       this->isset=true;    return true;    }   }    else return false;  } 

note if "this->isset=true;" lines commented out error not manifest regardless of number of structures :yes works 6! "isset" boolean value used determine objects have been set, , hence objects need written out data file further processing.

system , sodtware:

gcc (suse linux) 4.4.1 [gcc-4_4-branch revision 150839] suse 11.2 64bit intel celsius 4 xeon 2.66ghz cpus , 4gb ram eclipse cdt (ide) 64 bit build 20100218-1602

apparently, accessing elements outside of container. it's impossible code, whether indexes correct or not, walk through code in debugger , see. suspicious looking piece: this->beamlets.at(beamletnumber-1).isopen() if beamletnumber 0? invalid index.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -