[gnet-dev] Memory leak.
- From: "Chris" <chris nerdskill com>
- To: <gnet-dev gnetlibrary org>
- Subject: [gnet-dev] Memory leak.
- Date: Mon, 30 Jun 2003 12:09:20 -0400
I posted a bug on the 27th and I've been trying to find the source of this
leak myself over the weekend with no success. The bug is reproducable on
both linux and FreeBSD.
http://bugzilla.gnome.org/show_bug.cgi?id=116162
If anybody has some insight to it other than blaming the stdc lib function
getaddrinfo() please let me know. This might seem small (4 bytes per
connection) but on a long-running program with thousands of connections, it
leaks 50mb+ per hour and the program has to be restarted every few hours
before it runs out of memory to alloc.
To reproduce the bug, just let this run for a while and watch the usage
(top/ps/whatever):
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <gnet.h>
void memory_test() {
GInetAddr* addr=gnet_inetaddr_new("doro.limsi.fr",6666);
gnet_inetaddr_delete(addr);
}
int main() {
gnet_init();
while (1) {
memory_test();
usleep(1000);
}
return(0);
}
This code was just a modified version of a bug posted a while back, on linux
it doesn't seem to leak as much, but leave it run for a day and it will eat
up a ridiculous amount of memory. On FreeBSD the effect is noticable almost
immediately.
Chris
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]