out of memory
Maxim Kizub
max at immsp.kiev.ua
Mon Jan 11 02:15:03 PST 1999
One another solution is to preallocate (and precompiler)
the OutOfMemoryException class itself _and_ preallocate
a reasonable-sized object or a chunk of memory.
When memory manager is about to throw this exception,
and free memory size is smaller, that a specified amount
(for example, 50 kb), this preallocated (reserved) memory
should be forced to be freed.
If a free amount of memory above that specified size will
be available later - memory manager must reserve it again.
Godmar Back wrote:
>
> >
> > This is a quote from gc_heap_malloc:
> >
> > /*
> > * If we ran out of memory, a OutOfMemoryException is
> > * thrown. If we fail to allocate memory for it, all
> > * is lost.
> >
> > If there is not enough memory for an OutOfMemoryException, kaffe crashes
> > with "Segmentation fault" and no message, which is pretty annoying. I see
> > no reason why the objects needed to throw this exception cannot be
> > allocated in advance such that kaffe could always throw this exception and
> > exit decently (if the exception is not caught by the app).
> > Am I missing something here?
> >
>
> It is true that out of memory exceptions are broken in kaffe.
> This is noted in the FAQ.
>
> One of the more obvious things needed to fix them is to preallocate
> the exception. However, there's a lot more to it. For instance,
> we must ensure that there is enough memory to throw (and possibly
> catch the exception and continue after a gc if the application drops some
> objects). This may involve just-in-time compiling code, which requires
> memory.
>
> More importantly, we must ensure that the VM does not throw the exception
> when executing protected sections of code.
> This will be implemented.
>
> I agree with you that an interim solution that at least allows to exit kaffe
> decently would be nice to have.
>
> - Godmar
More information about the kaffe
mailing list