Premature end of image file--so close

John M McIntosh johnmci at
Wed May 19 01:51:26 UTC 2004

Well you could make a copy of the image file, and alter the length  
information to what the file length is and see
what happens.

a) I'd think you'll get an error because you are missing the end of  
image (See Interpreter>>byteSwapByteObjectsFrom:to:)
& ObjectMemory>>objectAfter:

You might have to fiddle to set the end of memory marker.

b) Also turn on DoAssertionChecks just to be paranoid (In  
ObjectMemory>>initialize & rebuild VM)

Maybe you are missing pointers from Old space to new space, but the  
first full GC will tell you that....
Maybe you'll get lucky.

On May 18, 2004, at 6:27 PM, Ross Boylan wrote:

> On Tue, May 18, 2004 at 11:11:19AM -0700, Tim Rowledge wrote:
>> Ross Boylan <RossBoylan at> wrote:
>>> On Fri, May 14, 2004 at 09:49:42PM -0700, Ross Boylan wrote:
>>>> When I try to start squeak, I get
>>>> "Read failed or premature end of image file"
>>> I think I see the code that issues the error
>>> (readImageFromFile:HeapSize:StartingAt:).  The image internally says
>>> it should be 43,914,644 bytes.(*) ls -l says the file is 43,913,280.
>> I you've actually lost bits from the file, you're screwed.  Since we  
>> do
>> a garbage collect before snapshotting, every bit in the supposed dump
>> is sacred, every little one (and zero). At the top end of memory  
>> you're
>> going to be missing some relatively new objects that are being pointed
>> to by older ones. Dangling pointers are not allowed!
>> Basically you can usually rescue a lot from the changes log assuming  
>> it
>> wasn't also mangled somewhere along the line.
>> tim
> The stuff I want is all data.  Even if I lost the most recent stuff,
> it would still be nice to recover the rest.
> I'm imagining going through the image fragment and identifying all
> pointers to destroyed space and replacing them with .... maybe nil,
> though I'd need some way of identifying where the damaged pointers
> were to verify what happened.
> So far I've restrained myself because this seems like a potentially
> big and slightly silly project.  But is it impossible?
> (Ideally, I'd replace each bad reference with a stub object that
> included the pointer, so I could tell which stubs were pointing to the
> same place.  The problem is that I have no stub class in the image.)
John M. McIntosh <johnmci at> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.

More information about the Squeak-dev mailing list