#24 Memory leak?

open
nobody
None
5
2005-08-05
2005-08-05
Arkady Paronyan
No

I've encountered a memory leak in my application which
uses blat.dll to send messages. Every time blat fails to
connect to smtp server it leaves about 100kb of allocated
memory. I've checked the source code and suspect the
following allocation:

file: gensock.cpp
routine: gensock_connect()
line: 911
connection * conn = new connection;

after connection fails gensock_close() is called, but it
returns after conn->close(), and connection is not
removed from the global_socket_list

Discussion

  • Logged In: NO

    I will check the source this evening when I get home.

    Chip

     
  • Chip
    Chip
    2005-10-01

    Logged In: YES
    user_id=800692

    I added "delete conn;" immediately after the call to
    gensock_close() in that routine. This should resolve the
    memory leak. Did you do the same, and does it work?

    Chip

     
  • Logged In: YES
    user_id=1324447

    I moved these two lines to the end of the routine, replacing the
    final "return (0);"

    if ( retval )
    return(retval);

    And it solved the problem, I think it does not differ much from
    what you did.

    Thanks for the response

    Arkady