Insufficient memory error from forward become primitive

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Insufficient memory error from forward become primitive

Henrik Sperre Johansen
 
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 <[hidden email]> 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 <[hidden email]> 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



signature.asc (859 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Insufficient memory error from forward become primitive

Levente Uzonyi
 
It works in Squeak 5.1.

Levente
Reply | Threaded
Open this post in threaded view
|

Re: Insufficient memory error from forward become primitive

Henrik Sperre Johansen
Indeed, I'd forgotten the previous thread from June, thanks!
(http://forum.world.st/Spur-endless-recursion-in-forward-become-td4901177.html)

Cheers,
Henry
Reply | Threaded
Open this post in threaded view
|

Re: Insufficient memory error from forward become primitive

Clément Béra
In reply to this post by Levente Uzonyi
 
Someone had a similar issue in Pharo with large images. I think it's worth looking at (if someone can reproduce).

On Mon, Sep 12, 2016 at 6:38 PM, Levente Uzonyi <[hidden email]> wrote:

It works in Squeak 5.1.

Levente

Reply | Threaded
Open this post in threaded view
|

Re: Insufficient memory error from forward become primitive

Eliot Miranda-2
 
Hi Clément,


On Sep 12, 2016, at 10:49 AM, Clément Bera <[hidden email]> wrote:

Someone had a similar issue in Pharo with large images. I think it's worth looking at (if someone can reproduce).

On Mon, Sep 12, 2016 at 6:38 PM, Levente Uzonyi <[hidden email]> wrote:

It works in Squeak 5.1.

IIRC it's already solved.   There was a VM bug (unnecessary copying) that was fixed, and the image level code needs to check for out-of-memory and if so, GC and repeat.


Levente


_,,,^..^,,,_ (phone)