Skip to content
Snippets Groups Projects
  • Damien George's avatar
    7b2a9b05
    py/pystack: Use "pystack exhausted" as error msg for out of pystack mem. · 7b2a9b05
    Damien George authored
    Using the message "maximum recursion depth exceeded" for when the pystack
    runs out of memory can be misleading because the pystack can run out for
    reasons other than deep recursion (although in most cases pystack
    exhaustion is probably indirectly related to deep recursion).  And it's
    important to give the user more precise feedback as to the reason for the
    error: if they know precisely that the pystack was exhausted then they have
    a chance to increase the amount of memory available to the pystack (as
    opposed to not knowing if it was the C stack or pystack that ran out).
    
    Also, C stack exhaustion is more serious than pystack exhaustion because it
    could have been that the C stack overflowed and overwrote/corrupted some
    data and so the system must be restarted.  The pystack can never corrupt
    data in this way so pystack exhaustion does not require a system restart.
    Knowing the difference between these two cases is therefore important.
    
    The actual exception type for pystack exhaustion remains as RuntimeError so
    that programatically it behaves the same as a C stack exhaustion.
    7b2a9b05
    History
    py/pystack: Use "pystack exhausted" as error msg for out of pystack mem.
    Damien George authored
    Using the message "maximum recursion depth exceeded" for when the pystack
    runs out of memory can be misleading because the pystack can run out for
    reasons other than deep recursion (although in most cases pystack
    exhaustion is probably indirectly related to deep recursion).  And it's
    important to give the user more precise feedback as to the reason for the
    error: if they know precisely that the pystack was exhausted then they have
    a chance to increase the amount of memory available to the pystack (as
    opposed to not knowing if it was the C stack or pystack that ran out).
    
    Also, C stack exhaustion is more serious than pystack exhaustion because it
    could have been that the C stack overflowed and overwrote/corrupted some
    data and so the system must be restarted.  The pystack can never corrupt
    data in this way so pystack exhaustion does not require a system restart.
    Knowing the difference between these two cases is therefore important.
    
    The actual exception type for pystack exhaustion remains as RuntimeError so
    that programatically it behaves the same as a C stack exhaustion.