This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author christian.heimes
Recipients benjamin.peterson, christian.heimes, ctheune, ebfe, gvanrossum, hynek
Date 2012-11-02.14:50:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1351867830.4.0.621324916198.issue16381@psf.upfronthosting.co.za>
In-reply-to
Content
Of course it can be fixed. But it's going to be a long and tedious piece of work. PyErr_NoMemory() is called 314 times. MemoryError is raised about 40 times in C code.

I'm not sure what your question about realloc() really is. Are you unsure how a a failing realloc() calls must be resolved?

Code like

  ptr = realloc(ptr, size);

is usually a memory leak as it leaks the previously allocated memory in ptr. In the error case the block in ptr is left untouched and is still valid. It must be freed manually or can be used further and freed later.

  if((ptr2 == realloc(ptr, size)) == NULL) {
    free(ptr);
  }
  else {
    ptr = ptr2;
  }
History
Date User Action Args
2012-11-02 14:50:30christian.heimessetrecipients: + christian.heimes, gvanrossum, ctheune, benjamin.peterson, ebfe, hynek
2012-11-02 14:50:30christian.heimessetmessageid: <1351867830.4.0.621324916198.issue16381@psf.upfronthosting.co.za>
2012-11-02 14:50:30christian.heimeslinkissue16381 messages
2012-11-02 14:50:30christian.heimescreate