So #sufficientSpaceToInstantiate:indexableSize: call can be removed?
Mth
On Aug 20, 2007, at 6:37 PM, Andreas Raab wrote:
Adrian Lienhard wrote:
Out of curiosity, does anybody know why in... primitiveNew "Allocate a new fixed-size instance. Fail if the allocation would leave less than lowSpaceThreshold bytes free. May cause a GC" | class spaceOkay | class := self stackTop. "The following may cause GC!" spaceOkay := self sufficientSpaceToInstantiate: class indexableSize: 0. self success: spaceOkay. successFlag ifTrue: [ self push: (self instantiateClass: self popStack indexableSize: 0) ] ... there is the call to #sufficientSpaceToInstantiate:indexableSize: although #instantiateClass:indexableSize: also indirectly calls #sufficientSpaceToAllocate:?
Where does it do that?
Both, the primitive fallback code and the vm code signal the low space sem in case of failure.
The fallback code in the image is broken IMO. It needs to signal OutOfMemory instead of the low space semaphore. We had our servers go belly-up because of malformed requests that requested a 1 gigabyte or more memory.
Cheers,
- Andreas