[Vm-dev] [squeak-dev] Endless recursion: "String new: -1"
David T. Lewis
lewis at mail.msen.com
Thu Jul 7 23:17:46 UTC 2016
On Thu, Jul 07, 2016 at 11:03:43PM +0200, Tobias Pape wrote:
> On 07.07.2016, at 19:48, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> > I disagree. There are implementation limits. So answering #'unsupported operation' or #'bad argument 's as logical and defensible as #'out of memory' and actually truer. The VM does /not/ try and allocate memory beyond the address space size. So actually the failure for > the range 0 to 2^32-1 or 0 to 2^64-1 as #'out of memory' is untrue; the reason is not because the ysste, os out of memory; the reason is that this is a bad argument, outside of the valid range of the primitive.
> Disregarding my other tongue in cheek reply,
> does that mean, the test worked in older images/Vms, because those treated every failure due to
> arguments (be it size or kind) as 'out of memory'?
No, in Squeak 4.5 trying to recover from the 'out of memory' condition
is done if and only if the sizeRequested was a positive integer, otherwise
it is a primitiveFailed condition.
ByteString class>>basicNew: sizeRequested
"Primitive. Answer an instance of this class with the number
of indexable variables specified by the argument, sizeRequested.
Fail if this class is not indexable or if the argument is not a
positive Integer, or if there is not enough memory available.
Essential. See Object documentation whatIsAPrimitive."
self isVariable ifFalse:
[self error: self printString, ' cannot have variable sized instances'].
(sizeRequested isInteger and: [sizeRequested >= 0]) ifTrue:
["arg okay; space must be low."
^ self basicNew: sizeRequested "retry if user proceeds"].
More information about the Vm-dev