Memory leak in req.readlines() ????
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Mod-Python > Memory leak in req.readlines() ????




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Memory leak in req.readlines() ????  
Graham Dumpleton


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-12-07 06:13 AM

This code in req.readlines() looks a bit fishy to me and possibly leaks memo
ry.
The code in question is:

rlargs = PyTuple_New(0);
if (result == NULL)
return PyErr_NoMemory();

line = req_readline(self, rlargs);
while (line && ((linesize=PyString_Size(line))>0)) {
PyList_Append(result, line);
size += linesize;
if ((sizehint != -1) && (size >= sizehint))
break;
Py_DECREF(line);
line = req_readline(self, args);
}
Py_XDECREF(line);

The thing that looks wrong is 'rlargs'. This is created, used in a sub call 
to
req_readline() but then never destroyed. Thus, possibly a memory leak.

Next thing is that on the first read of a line, ie., call to req_readline(),
there will be no limit on size, as rlargs (empty tuple) is used. On subseque
nt
calls to req_readline() it passed the args from the caller instead of rlargs
.
Depending on how req_readline() is implemented, this may not work
how want might think it might. Will need to investigate further.

Graham







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 01:00 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register