DependentsArray size and subscript is out of bounds

Andrew Tween amtween at hotmail.com
Fri Jul 21 09:45:11 UTC 2006


If you still have problems, even with the garbage collect, then you could try
modifying DependentsArray>>copyWith: to something like this...

---------
copyWith: newElement
 "Re-implemented to not copy any niled out dependents.
 The receiver's elements are copied into a temporary collection
 to prevent them from being being garbage collected while the
 copy is being made"
 | answer tmp element |

 tmp := IdentitySet new: self basicSize.
 1 to: self basicSize do:[:i2 |
  (element := self at: i2)
   ifNotNil:[tmp add: element]].
 answer := self class streamContents:[:s|
  self do:[:item| s nextPut: item].
  s nextPut: newElement].
 ^answer
-----------

This solves the previous "test case", and doesn't appear to have any adverse
effects.
Cheers,
Andy

----- Original Message ----- 
From: "Mathieu SUEN" <mathk.sue at gmail.com>
To: "The general-purpose Squeak developers list"
<squeak-dev at lists.squeakfoundation.org>
Sent: Friday, July 21, 2006 10:23 AM
Subject: Re: DependentsArray size and subscript is out of bounds


> 2006/7/21, Marcus Denker <denker at iam.unibe.ch>:
> >
> > On 20.07.2006, at 10:37, Andrew Tween wrote:
> >
> > >
> > >
> > > I have also seen this problem when using Smacc, but didn't solve
> > > the root cause
> > > of the problem. I just did a garbage collect before generating the
> > > parser/scanner and the problem went away.
> > >
> >
> > So I changed the parser generator to do a "Smalltalk garbageCollect"
> > befor compiling
> > a grammar. It's in SmaCCDev-md.4.mcz
> >
> > http://www.squeaksource.com/SmaccDevelopment
> >
> > I did not yet test if it really helps, though.
> >
> >         Marcus
> >
> >
> Yep thanks Marcus I will try
> >
> >
> >
> >
>
>
-------------- next part --------------
'From Squeak3.9alpha of 4 July 2005 [latest update: #7046] on 20 July 2006 at 10:46:27 am'!

!DependentsArray methodsFor: 'copying' stamp: 'tween 7/20/2006 10:46'!
copyWith: newElement 
	"Re-implemented to not copy any niled out dependents.
	The receiver's elements are copied into a temporary collection
	to prevent them from being being garbage collected while the
	copy is being made"
	| answer tmp element |

	tmp := IdentitySet new: self basicSize.
	1 to: self basicSize do:[:i2 | 
		(element := self at: i2) 
			ifNotNil:[tmp add: element]].
	answer := self class streamContents:[:s|
		self do:[:item| s nextPut: item].
		s nextPut: newElement].
	^answer
	! !



More information about the Squeak-dev mailing list