Michael Zwick wrote: >From zwickmich at web.de Wed Sep 18 13:25:10 2002 Received: by morannon.frodo.local (8.11.3/8.11.3) id g8IBPAH28592 ; Wed, 18 Sep 2002 13:25:10 +0200 Return-Path: <zwickmich at web.de> Received: from pop3.dds.nl [213.196.1.122] by localhost with POP3 (fetchmail-5.4.4) for frodo at localhost (single-drop); Wed, 18 Sep 2002 13:25:10 +0200 (CEST) Received: (qmail-ldap/ctrl 6707 invoked from network); 18 Sep 2002 11:12:00 -0000 Received: from mailgate5.cinetic.de ([217.72.192.165]) (envelope-sender <zwickmich at web.de>) by mx3.dds.nl (qmail-ldap-1.03) with SMTP for <frodol at dds.nl>; 18 Sep 2002 11:12:00 -0000 Received: from web.de (fmomail02.dlan.cinetic.de [172.20.1.46]) by mailgate5.cinetic.de (8.11.2/8.11.2/SuSE Linux 8.11.0-0.4) with SMTP id g8IBBxX11044 for frodol at dds.nl; Wed, 18 Sep 2002 13:11:59 +0200 Date: Wed, 18 Sep 2002 13:11:59 +0200 Message-Id: <200209181111.g8IBBxX11044 at mailgate5.cinetic.de> MIME-Version: 1.0 Organization: http://freemail.web.de/ From: Michael Zwick <zwickmich at web.de> To: frodol at dds.nl Subject: Question to libsensors, due to a memory leak in a program. Precedence: fm-user Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Loop-Procmail: PreventLoop Hello Frodo Looijaard, I am a german student and currently writing a small graphical frontend for= lm=5Fsensors. Everything works as I wish, but I encountered a small memory leak that has= to do with the=20 "sensors=5Fget=5Flabel"-function of libsensors. I asked in several diskussion boards in the net, but nobody could help me.= (If I ask the wrong person, or if you don't find the time to help/answer, = I would be pleased if you could tell me=20 who I could ask). One function, I wrote, uses the following commands: int i=3D0, nr1=3D0, nr2=3D0; const sensors=5Fchip=5Fname * sensors=5Fchip; const sensors=5Ffeature=5Fdata * sensor=5Fdata; sensors=5Fchip =3D sensors=5Fget=5Fdetected=5Fchips( &i)) sensor=5Fdata =3D sensors=5Fget=5Fall=5Ffeatures( *sensors=5Fchip, &nr1, &nr2)) char * label; sensors=5Fget=5Flabel ( *sensors=5Fchip, sensor=5Fdata->number, &label); The last of the seven lines is called periodically ( eg. all 3 seconds). This causes a leak of 4 bytes about every 10 seconds (more or less). Four byte ist not much, but unacceptable. I am sure that the sensors=5Fget=5Flabel-command is "guilty", because if I com= ment this line ( using //) I can run=20 my program for hours without "loosing" this four bytes periodically. So I added the following line as adviced in your sensors.h (quote: "*resul= t is newly allocated (free it=20 yourself)"). free( label); But this did not change anything. The memory leak did not vanish. I hope this is enough information so that you (or someone else) can help m= e.=20 How can I get rid of this memory leak=3F Yours sincerely, Michael Zwick =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F Die clevere Geldreserve: der DiBa-Privatkredit. Funktioniert wie ein Dispo= ,=20 ist aber viel g=FCnstiger! Alle Infos: http://diba.web.de/=3Fmc=3D021104 -- Frodo Looijaard <frodol at dds.nl> PGP key and more: http://huizen.dds.nl/~frodol Defenestration n. (formal or joc.): The act of removing Windows from your computer in disgust, usually followed by the installation of Linux or some other Unix-like operating system.