[squeakland] Ran out of space while loading?

Bob Arning arning315 at comcast.net
Sun Mar 11 12:49:03 UTC 2018

Expanding memory may well be possible when Etoys migrates to newer VMs, 
but I don't know when that will happen and it won't help people trying 
to load this into vanilla Etoys.

Attached is a fix that will allow your project to load.

On 3/11/18 4:29 AM, Jeremy Landry wrote:
> Okay, so I probably should have taken care of this 'bug' before it 
> became an issue.  I know how to fix it, but was in lazy mode.
> Basically, I have a ton of copied images that are stored in memory so 
> this project is 45MB in size (the fix involves saving the original 
> reference only and then all of the objects that have the copies revert 
> their images to dots on closing the project or page of the book they 
> are in and then using that reference on load to restore their 
> graphic).  When loading it errors out with disk space low error, 
> meaning I cannot open it up anymore, but it saved just fine.
> Is there a way to get this project open by expanding memory 
> temporarily for the VM?
> I promise to fix the problem as soon as I get back in there!  And 
> don't worry, I do have an earlier copy that does open that I can work 
> with, it's just that this one, I spent a bit of time in with the page 
> in question making some assets and wouldn't mind not losing 
> them...plus if I run into this problem in the future, I can solve it 
> again.
> Thanks for any help.
> Here's the project in question if someone also just wants to hack it 
> to load properly or needs to see it if they have some magical 
> smalltalk tools that will auto-fix it.  I'm not aware of such things, 
> so if you do anything, please document it!  :)
>> ---step 05.015.pr 
> <https://drive.google.com/file/d/1uEv4NKIW-AdxzoQJ3XhXchtQSCKZXrXf/view?usp=drive_web>
> ​​​
> _______________________________________________
> squeakland mailing list
> squeakland at lists.squeakland.org
> http://lists.squeakland.org/mailman/listinfo/squeakland

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakland.org/pipermail/squeakland/attachments/20180311/1823c7ff/attachment.html>
-------------- next part --------------
'From etoys5.0 of 29 March 2012 [latest update: #2406] on 11 March 2018 at 8:45:54 am'!
"Change Set:		BigBinaryReadFix
Date:			11 March 2018
Author:			Bob Arning

In loading a large ImageSegment for a Project, lowSpace was reached. Reading the segment required 3 full copies, one in the ReadStream, one as the String just read and one for the ByteArray to convert the String into. Eliminate one of these by reading directly into a ByteArray if the ReadStream is in binary mode."!

!ReadWriteStream methodsFor: 'accessing' stamp: 'raa 3/11/2018 08:34'!
nextBinary: anInteger 
	"Answer the next anInteger elements of my collection.  overriden for efficiency"

	| ans endPosition |
	readLimit := readLimit max: position.

	endPosition _ position + anInteger  min:  readLimit.
ans _ ByteArray new: endPosition - position.
ans replaceFrom: 1 to: ans size with: collection startingAt: position+1 .

	position _ endPosition.
! !

!MultiByteBinaryOrTextStream methodsFor: 'public' stamp: 'raa 3/11/2018 08:34'!
next: anInteger 

	| multiString |
	"self halt."
	self isBinary ifTrue: [^ (super nextBinary: anInteger)].
	multiString _ WideString new: anInteger.
	1 to: anInteger do: [:index |
		| character |
		(character _ self next) ifNotNil: [
			multiString at: index put: character
		] ifNil: [
			multiString _ multiString copyFrom: 1 to: index - 1.
			^ multiString
	^ multiString.
! !

More information about the squeakland mailing list