cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Persistant connection with a memory problem

From: Michael Hecker <Hecker.Michael_at_gmx.de>
Date: Sun, 25 May 2008 19:38:30 +0200

Daniel Stenberg schrieb:
> On Sun, 25 May 2008, Michael Hecker wrote:
>
>> My main problem is that private bytes (virtual memory) and working
>> set ( physical memory) are continously getting bigger and bigger.
>> What can I do about that?
>
> What libcurl version? And while you showed us code, we don't see how
> you use it. Can you show us a complete example that leaks memory?
I'm using version: libcurl-7.16.4-win32-ssl-sspi

http://localhost/test.csv - test.csv contains plain-text and is about
500Kb big. It doesn't matter which kind of content I'm receiving.

Two examples which are both leaking:
EXAMPLE 1: This example obviously doesn't hold the connection. I wanted
to get closer to the problem, but the memory is still growing.

bool abc::test()
{
    ::AfxBeginThread(test_worker, this);
    return true;
}
UINT abc::test_worker(LPVOID pParam)
{
    Communicator* pDlg = (abc*) pParam;
    int i=1;

    while(true)
    {
        Communicator *con1 = new Communicator();

        TRACE("abfrage %i\r\n",i);
        i++;

        CString quellcode;
        con1->communicate("http://localhost/test.csv","",quellcode,"");

        con1->_delete();
        delete con1;
    }

    return true;
}

EXAMPLE 2: con1 is a global instance of my class

bool abc::test()
{
    ::AfxBeginThread(test_worker, this);
    return true;
}
UINT abc::test_worker(LPVOID pParam)
{
    Communicator* pDlg = (abc*) pParam;
    int i=1;

    while(true)
    {
        TRACE("abfrage %i\r\n",i);
        i++;

        CString quellcode;
        con1->communicate("http://localhost/test.csv","",quellcode,"");
    }

    return true;
}

>
>> Additionally, I'm getting something like 100.000 'page faults' per
>> seconds. What can I do about that?
> Can you elaborate some more on this? What exactly is the problem?
>
This problem has a much lower priority. I would like to fix the memory
size problem first.

Thank you,
Michael
Received on 2008-05-25