[Coin-discuss] Segmentation fault in CoinPackedMatrix

Matthew Galati magh at lehigh.edu
Thu Jan 22 09:11:24 EST 2004


sorry... typo in last post

"That is, it does *not* handle the case where the minor... "


Matthew Galati wrote:
> Looking over appendMajorVector again, I noticed that resize is only 
> called if the buffer for major dimension (cols) or number of elements is 
> exceeded. That is, it does handle the case where the minor dimension is 
> too small - hence, the throw statement. So, for using the append 
> functions, you do need to setDimensions first. It would be nice to have 
> a resize that can handle this. But, the current implementation makes 
> sense (in most cases), since typically you append columns then rows in 
> sequence. So, in each call to appendCol you are operating on a fixed 
> size of rows, and the number of columns is incremented. Then, when you 
> appendRow it has the right number of columns (which is again fixed). If 
> you do have an application that might add both at the same time, you can 
> call setDimensions to resize your matrix beforehand.
> 
> Matt
> 
> 
> 
>> Ok. I tried to add the COIN_DEBUG and it actually throws the exception 
>> if the minor dimension is not set to 2. If I do a 
>> check.setDimensions(2,0) then it works. As I read the code this must 
>> always be done? As you note, the only reason for having this throw 
>> block is a bug in the resize or that it is simply an invariant? And by 
>> the way the small code snip that I did seems to dump only on Linux and 
>> not MSV6 while the orginal code dumps on both. Obviously this was 
>> without COIN_DEBUG defined. The fix for now is to call setDimensions 
>> which is possible in my application since the number of rows is 
>> constant. Thanks.
>>
>> 'Jesper
> 
> 




More information about the Coin-discuss mailing list