[Python-Dev] Mixing memory management APIs (original) (raw)

Neal Norwitz neal@metaslash.com
Wed, 30 Jan 2002 19:13:58 -0500


Because of Michael Hudson's request, I tried running Purify --with-pymalloc enabled. The results were a bit surprising: 13664 errors!

All the errors were in unicodeobject.c. There were 3 types of errors: Free Memory Reads, Array Bounds Reads, and Unitialized Memory Reads. The line #s were in strange places (e.g., in a function declaration and accessing self->length in an if clause, after it was accessed w/o error). The line #s are primarily: unicodeobject.c:2875, and unicodeobject.c:2214.

Has anyone run else used Purify and/or Insure --with-pymalloc?

BTW, I test_curses fails:
test test_curses crashed -- _curses.error: curs_set() returned ERR

Solaris 2.8, Purify 2002.

Neal

Problems (error lines begin with =>)

        PyUnicode_TranslateCharmap [unicodeobject.c:2214]
           
           PyObject *PyUnicode_EncodeASCII(const Py_UNICODE *p,
                                           int size,
        =>                                 const char *errors)
           {
               PyObject *repr;
               char *s, *start;

        split_char     [unicodeobject.c:2875]
               if (end > self->length)
                   end = self->length;
               if (end < 0)
        =>         end += self->length;
               if (end < 0)
                   end = 0;