Re: [Cython] [cython-users] C++: how to handle failures of 'new'?
Den 4. juli 2012 kl. 08:06 skrev Stefan Behnel : > > > Also, the allocation may have failed on a larger block of memory, which is > then unused when the exception gets raised and can be used by cleanup code. > I really don't think the world is all that dark here. > > Indeed. But how to tell? malloc a small buffer and see if it works? Sturla ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel
Re: [Cython] [cython-users] C++: how to handle failures of 'new'?
Sturla Molden, 04.07.2012 13:03: > Den 4. juli 2012 kl. 08:06 skrev Stefan Behnel: >> Also, the allocation may have failed on a larger block of memory, which is >> then unused when the exception gets raised and can be used by cleanup code. >> I really don't think the world is all that dark here. > > Indeed. But how to tell? malloc a small buffer and see if it works? In the worst case, you'd get another memory error during cleanup and it would keep rippling up the stack. Stefan ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel
Re: [Cython] [cython-users] C++: how to handle failures of 'new'?
Sendt fra min iPad Den 4. juli 2012 kl. 14:33 skrev Stefan Behnel : >> >> Indeed. But how to tell? malloc a small buffer and see if it works? > > In the worst case, you'd get another memory error during cleanup and it > would keep rippling up the stack. > > Which is why I wrote 'malloc' instead of 'new'. It doesn't throw a new exception. :-) Sturla ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel
Re: [Cython] [cython-users] C++: how to handle failures of 'new'?
Sturla Molden wrote: > > >Sendt fra min iPad > >Den 4. juli 2012 kl. 14:33 skrev Stefan Behnel : > >>> >>> Indeed. But how to tell? malloc a small buffer and see if it works? >> >> In the worst case, you'd get another memory error during cleanup and >it >> would keep rippling up the stack. >> >> > >Which is why I wrote 'malloc' instead of 'new'. It doesn't throw a new >exception. :-) I think Stefan's point was you don't need to tell. I don't understand what Sturla is getting at either...are you saying that you can't rely on the C++ exception type (std::bad_alloc or whatever it is?) and translate that to MemoryError? I think one would translate a catch(...) to a RuntimeError (or a subclass) At any rate probing will never work, the failing allocation *could* be that a 50 GB buffer was requested (in fact that's when it is extremely convenient to have a stack trace). Dag > >Sturla > > > > > > >___ >cython-devel mailing list >cython-devel@python.org >http://mail.python.org/mailman/listinfo/cython-devel -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel