Thread: Eeeek a leak

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    41

    Eeeek a leak [fixed]

    I think I have my first memory leak.
    My chatserver climbs all the time in memory usage, 0.1% more almost everytime "top" refreshes. After a few minutes I'm at around 10% (25 MB) even when I do nothing and there is no connection and it starts at 2%. This is a memory leak, right?
    Any pointers what could cause memory leaks? My code is still small so it should be easy to find. I don't use any malloc().
    Is there some good beginners tutorial about where to look for leaks?
    I also noticed that my server has three threads running in top as soon as I start it. But I do only spawn one at the beginning and one for every new connection. So I would expect 2 + # of connections but it's 3 + # of connections. Is this usual?
    Last edited by Spark; 05-29-2002 at 02:57 PM.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826

    Re: Eeeek a leak

    Originally posted by Spark
    My code is still small so it should be easy to find.
    Your code is so small, I can't even see it! Perhaps if you included it, we may have something to go on.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    41

    Smile

    Well, it's not _that_ small. But I just found it, sorry! I could localize the problem and found that I was just querying a mysql db in a while loop and forgot to do a mysql_free_result() between each loop.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Detecting memory leak in complicating source code
    By mosxopul in forum C++ Programming
    Replies: 5
    Last Post: 03-30-2009, 11:41 AM
  2. Question regarding Memory Leak
    By clegs in forum C++ Programming
    Replies: 29
    Last Post: 12-07-2007, 01:57 AM
  3. Is this a memory leak?
    By cboard_member in forum C++ Programming
    Replies: 9
    Last Post: 07-20-2005, 01:15 PM
  4. Memory leak trackers
    By Darkness in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 11-30-2004, 02:03 PM
  5. Why is this a memory leak?
    By deadpoet in forum C++ Programming
    Replies: 2
    Last Post: 02-20-2004, 11:16 AM