From: Sam Liao <phyomh@gmail.com>
To: Glynn Clements <glynn@gclements.plus.com>
Cc: "Uğur ATA" <ataugur@gmail.com>,
linux-c-programming <linux-c-programming@vger.kernel.org>
Subject: Re: Help on a memory leak issue
Date: Tue, 12 Jan 2010 16:02:03 +0800 [thread overview]
Message-ID: <da5b0fda1001120002je8f34e0lc8956ed8a88c55e@mail.gmail.com> (raw)
In-Reply-To: <19275.35871.267090.666667@cerise.gclements.plus.com>
Instead of read each line in details, have a try for valgrind.
-Sam
On Tue, Jan 12, 2010 at 4:37 AM, Glynn Clements
<glynn@gclements.plus.com> wrote:
>
> Uğur ATA wrote:
>
>> I have a client server application which uses a local file socket.
>> When i connect to the server part and then close the connection the
>> memory usage stays the same indicating that the resources aren't
>> freed. Other then this memory leak problem everything is working fine.
>> Messeages are sent and received. After each message is sent/received
>> rss indicator in the ps command increases with different amounts for
>> each different message. When the rss reaches around 64MB the program
>> stops working and freezes. Then it needs to be restarted.
>> I couldn't find a solution to this problem anywhere on the web so
>> thanks in advance if someone could be of help.
>> Below is the result of uname -a:
>> Linux server 2.6.27.7-smp #2 SMP Thu Nov 20 22:32:43 CST 2008 i686
>> Pentium III (Katmai) GenuineIntel GNU/Linux
>> Slackware 12.2 is running on that kernel and my source for the server part is:
>
> Whatever is causing the leak isn't in the portion of the code which
> you posted.
>
> Also:
>
>> struct sockaddr_un client_name;
>> socklen_t client_name_len = 0; // it should be >= 0 otherwise accept returns EINVAL
>> int client_socket_fd;
>> client_socket_fd = accept(socket_fd, &client_name, &client_name_len);
>
> If you want accept to initialise client_name, you should initialise
> client_name_len to the size of the buffer, i.e.:
>
> client_name_len = sizeof client_name;
>
> --
> Glynn Clements <glynn@gclements.plus.com>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2010-01-12 8:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-11 15:05 Help on a memory leak issue Uğur ATA
2010-01-11 20:17 ` ern0
2010-01-11 20:37 ` Glynn Clements
2010-01-12 8:02 ` Sam Liao [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=da5b0fda1001120002je8f34e0lc8956ed8a88c55e@mail.gmail.com \
--to=phyomh@gmail.com \
--cc=ataugur@gmail.com \
--cc=glynn@gclements.plus.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).