[Vm-dev] Insufficient memory error from forward become primitive

Henrik Johansen henrik.s.johansen at veloxit.no
Mon Sep 12 15:00:02 UTC 2016


I'm  able to (quite often, but not deterministically*) trigger an "insufficient object memory" primitive failure in elementsForwardIdentityTo:
when trying to convert a large ByteString to WideString, both in Squeak 5.0 and Pharo 5.0.


AFAICT, these are both 32bit Spur images**, and in

SpurMemoryManager >> containsOnlyValidBecomeObjects: array1 and: array2 twoWay: isTwoWay copyHash: copyHash
	 Otherwise answer an informative error code for the first offending object found:
		*snip*
		Two-way become may require memory to create copies => PrimErrNoMemory.

Size is initialized to 0, and only set in an isTwoWay ifTrue: branch (which elementsForwardIdentityTo: is not), so in

size >= (totalFreeOldSpace + (scavengeThreshold - freeStart)) ifTrue:
		[^PrimErrNoMemory].

either there's a signed/unsigned mismatch + overflow, or the right side of the equation can equal 0.
Will the needed allocation fail if size = , or can changing to a > be enough to avoid intermittent failures for forward becomes?
And how would proper handling code (which, afaict, is absent from both Pharo and Squeak) that ensures enough space will be available before retrying, look?

Or am I looking in entirely the wrong place, and in the VMs mentioned, the code raising the error resides in another castl... err, class?

Cheers,
Henry

*This seemed to fail at least 50% of the time in fresh Squeak 5.0 release and Pharo 5.0, with large periods of everything working "as expected" in between:
str := ByteString new: 1024*1023*3.
str at: 1 put: (Character value: 16r20AC).

**
Can trigger using:
------
Pharo image 50753 + VM (Mac):
Mac Cocoa Cog 5.8b12 21-Sep-10 >1B0534FA-246C-47C5-AB29-7A76C81CCDCB<
VMMaker versionString https://github.com/estebanlm/pharo-vm.git Commit: 6dc730123e8f2b0327839b235d16e0604a92288e Date: 2015-12-13 00:23:41 +0100 By: Esteban Lorenzano <estebanlm at gmail.com> Jenkins build #456
CoInterpreter * VMMaker.oscog-rmacnak.1586 uuid: 8e44b2a7-68ee-4fc9-8513-a04520267053 Dec 13 2015
StackToRegisterMappingCogit * VMMaker.oscog-rmacnak.1586 uuid: 8e44b2a7-68ee-4fc9-8513-a04520267053 Dec 13 2015
------
Pharo image 50759 + VM (Win):
Win32 built on May  4 2016 12:17:02 Compiler: 4.6.2
VMMaker versionString https://github.com/pharo-project/pharo-vm.git Commit: b8ec25a570d7539653e1d793e97609adb509aaed Date: 2016-05-04 11:14:22 +0200 By: Esteban Lorenzano <estebanlm at gmail.com> Jenkins build #589
CoInterpreter VMMaker.oscog-eem.1855 uuid: d8e4a3c2-a3bf-4adc-b224-8012903a1ef4 May  4 2016
StackToRegisterMappingCogit VMMaker.oscog-eem.1855 uuid: d8e4a3c2-a3bf-4adc-b224-8012903a1ef4 May  4 2016
------
Squeak5.0 latest update: #15117 + VM (Mac):
Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.1405] 5.0
Mac OS X built on Jul  6 2015 19:01:28 UTC Compiler: 4.2.1 (Apple Inc. build 5666) (dot 3)
platform sources revision VM: r3397 http://www.squeakvm.org/svn/squeak/branches/Cog Date: 2015-07-06 11:56:39 -0700 Plugins: r3347 http://squeakvm.org/svn/squeak/trunk/platforms/Cross/plugins
CoInterpreter VMMaker.oscog-eem.1405 uuid: 7aff388a-73ba-4202-bb5a-72b0759ff46b Jul  6 2015
StackToRegisterMappingCogit VMMaker.oscog-eem.1401 uuid: 036f0933-639a-49dd-8a1d-a03bcdcb0a0a Jul  6 2015


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20160912/67d401e9/signature.pgp


More information about the Vm-dev mailing list