[Bug: 21.5-b28] #'make-vector does not fail gracefully when handled a huge LENGTH

Aidan Kehoe kehoea at parhasard.net
Tue Feb 10 09:26:09 EST 2009


 Ar an deichiú lá de mí Feabhra, scríobh Stephen J. Turnbull: 

 > Aidan Kehoe writes:
 >  > ================================================================
 >  > Dear Bug Team!
 >  > 
 >  > In *scratch*, I evaluate: 
 >  > 
 >  >   (prog1
 >  >       nil
 >  >     (setq my-thing (make-vector most-positive-fixnum nil)))
 >  > 
 >  > My XEmacs crashes with the following backtrace: 
 > 
 > That looks like an OS bug to me.  The malloc should fail, shouldn't
 > it?

Probably. 

Things are fine if you hand make-vector #x7ffffff as the LENGTH argument,
which is most-positive-fixnum if you have 28-bit integers. If you hand it
#xfffffff, it takes a while, but is OK; when I then do #'garbage-collect, I
get, hilariously enough, 

(garbage-collect)
=> ((41885 . 22167) (4391 . 0) (50 . 114) 398448 -1073723772 [...] )

where -1073723772 is the number of used vector slots. 

 > The only reliable way to handle this that I can see is to install a
 > signal handler for this case, which restores sanity and then uninstall
 > it and signal a Lisp error -- but that involves two system calls.  Do
 > you have a suggestion?

No, not right now. Installing the handler should normally be necessary once,
though, surely? That shouldn’t impact most users at all.

-- 
¿Dónde estará ahora mi sobrino Yoghurtu Nghe, que tuvo que huir
precipitadamente de la aldea por culpa de la escasez de rinocerontes?




More information about the XEmacs-Beta mailing list