Hi,
Valgrind detected memleak on one of my test case, which is
a standard, textbook insertion sort. However, I don't see
any problem with the testcase. I'm wondering if this is
a false alarm, and should submit a bug report.
I'm using SuSE 10.1, and valgrind-3.2.0-11.1 from opensuse build
service.
The followings are the test case and the output of valgrind.
I've marked the offending line (line 36) in the testcase.
/************************** Test Case ************************/
#include <stdio.h>
#include <stdlib.h>
typedef struct _int_struct {
int i;
struct _int_struct *next;
} IntStruct;
typedef struct _int_list {
IntStruct *head;
} IntList;
int insert(IntList *ilist, int i);
int insertion_sort(IntList *ilist, IntStruct *is);
int main() {
IntStruct *is;
IntList ilist;
ilist.head = NULL;
insert(&ilist, 500);
insert(&ilist, 100);
printf("ilist: ");
for (is = ilist.head; is; is = is->next)
printf("%d ", is->i);
printf("\n");
return 0;
}
int insert(IntList *ilist, int i) {
IntStruct *is = (IntStruct *) calloc(1, sizeof(IntStruct)); /* line 36 */
is->i = i;
return insertion_sort(ilist, is);
}
int insertion_sort(IntList *ilist, IntStruct *is) {
IntStruct **isp;
for (isp = &ilist->head; *isp; isp = &((*isp)->next)) {
if (is->i < (*isp)->i) {
is->next = *isp;
break;
} else if (is->i == (*isp)->i) {
/* return FALSE; */
return 0;
}
}
*isp = is;
/* return TRUE; */
return 1;
}
/***********************************************************/
/************************ Valgrind Output ******************/
$ valgrind -q --leak-check=full ./a.out
ilist: 100 500
==15413==
==15413== 16 (8 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record 2 of 2
==15413== at 0x40206D5: calloc (vg_replace_malloc.c:279)
==15413== by 0x80484CD: insert (coba.c:36)
==15413== by 0x8048461: main (coba.c:24)
/***********************************************************/
--
Regards,
Verdi
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
Hello to all...
I'm starting a small project in JAVA, just to gather a little experience
with it.
The project I picked is a FIX (http://www.fixprotocol.org) message viewer.
It's comething that I think can be used, and a topic I have lots of experience
with, so that I can consentrate on the JAVA.
I'm using SUSE 10.1 as development platform.
I have extensive experience in programming (COBOL, PL/I, 360 Assembler, C/C++,
Smalltalk, Prolog, Perl, Python, just mention a few) and feel it's time I
did a little JAVA.
So anyone have tips, and gotchas I should watch out for?
Suggestions for how to get into a workbench with little effort?
Thx. for your help
Jerry
Hi List,
Well the subject says it all. "Sometimes"[0] make[1] misses that the
(c-)sources it should compile have been changed. Quiet a niusance.
Has anybody come across that, too?
Cheers
Michael
[0] Unfortunately this behaviour is not reproducable. 8-(
[1] make 3.80, gcc 4.02, SuSE 10
---- Graham Smith <gqs(a)westnet.com.au> wrote:
> Hi,
>
> I'm just starting to try and program using Qt and ruby using kdevelop version
> 3.3.3 on SuSE 10.0.
>
> As a starter I'm trying to get a very simple application working as per
> http://www.kdevelop.org/doc/technotes/rubyrad.html
>
> Now either I'm doing something wrong or there is something missing in the
> steps shown in the above document. On building the project the button does
> not appear on the window. The button widget does not appear to be created in
> any of the files.
>
> Does anyone know what I'm doing wrong.
>
> --
> Regards,
>
> Graham Smith
I don't know anything about Ruby, but out of curiosity I checked out the example using Kdevelop
3.3.1 on SUSE 9.2. I found that when I changed the name of the form to
MainBase, it did not get updated in the mainbase.ui file. I ended up
changing the line:
class MainImpl < Form1 to class MainImpl < MainBase.
This made the pushbutton show up.
Hope this helps,
Eric
Hi,
I'm just starting to try and program using Qt and ruby using kdevelop version
3.3.3 on SuSE 10.0.
As a starter I'm trying to get a very simple application working as per
http://www.kdevelop.org/doc/technotes/rubyrad.html
Now either I'm doing something wrong or there is something missing in the
steps shown in the above document. On building the project the button does
not appear on the window. The button widget does not appear to be created in
any of the files.
Does anyone know what I'm doing wrong.
--
Regards,
Graham Smith
Verdi March wrote on Monday, June 19, 2006 12:55 PM::
> Valgrind detected memleak on one of my test case, which is a standard,
> textbook insertion sort. However, I don't see any problem with the
> testcase. I'm wondering if this is a false alarm, and should submit a
> bug report.
The reason you're getting the report is because ilist is local to
main().
After leaving main() which is where valgrind does its leakage tests,
there is no longer a list, so there can be no references to the
allocated nodes. If you make ilist global, valgrind is silent.
Believe valgrind - it is wiser than mere humans!
There IS a very real leak that your example doesn't reveal:
> } else if (is->i == (*isp)->i) {
> /* return FALSE; */
> return 0;
> }
If you try to insert a node that is already in the list, "is" is not
linked into the list, and the caller (i.e. insert) has already
relinquished control so has no way of releasing the node. You would
be better off changing the code so that the calloc is only performed
once you've identified the need to insert the node (i.e. after the
for-loop in insertion_sort())
Phil
--
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the H.E Information Systems Ltd.
Tel: 0161 866 9066
Web: www.heis.co.uk
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.clearswift.com
**********************************************************************
I'm mostly curious - wath are the pros and cons of using a local UNIX
socket vs. an INET socket? E.g. having a daemon listen
on /var/lib/xxx/yyy.soc instead of localhost:nnnnn ? (it is assumed
that everyone involved will have the choice of using either one).
Any likely performance impacts (positive or negative)?
/Per Jessen, Zürich
Can anybody suggest how I set this up? I'd like pretty-printed pages of
C++ from emacs on SuSE 10.1.
I used to use pretty-print on xemacs. Postscript print on emacs produces
PostScript errors at the moment; so I'm using Kate for printing.
Just in case I provoke any zealotry, I use vi mode in emacs. I've
switched from xemacs because emacs now looks better and works with
AucTeX. And sometimes I use vim when I jsut want to do something quickly.
--
JDL
I do not have experience of interfacing Fortran with C.. I mean exchanging
and sharing data between C routines and Fortran routines linked together.
I would appreciate some guidelines how to do that.
Basically, assume the following common block is defined in a fortran
routine called "m1505.f":
COMMON/LEXP/DLEXP,TO,AINT
That is the Fortran routine defined the common block named "LEXP"
containing the three valiables DLEXP, TO, AINT
Now assume that such a Fortran routine is linked to some C routines and
some Tcl/Tk procedures through a GNUmakefile.
How can I, from inside a C routine, access the content of the variable
AINT in the common block LEXP ?
Thank you in advance for any suggestion.
Maura
Hi,
I have not had the time to closely follow the seemingly voluminous
postings on the issues that appear in the 10.1 release. (To the extent
it has distinct problems, I'm most interested in the commercial
distribution from Novell, which I've purchased and plan to install,
first in a Parallels virtual machine on a MacBook Pro portable).
I was wondering if there was a summary somewhere of what issues exist,
which installation or configuration options trigger them and what is
the current state of availability of fixes and / or work-arounds.
Is there, perhaps, a Wiki entry or some "Cool Tips" on the Novell or
openSUSE.org Web sites that hold this information? Or perhaps someone
has an independent Web page or pages on these issues?
The openSUSE.org Support Database (SDB) appears to have nothing. There
appears to be no mention of problems on the openSUSE installation page
nor on the Users' FAQ and How-To's pages. Some general Internet
searching turned up some blog rants, but nothing that would help me
avoid (or fill) the potholes.
I should say I'm not in a hurry about this. If the solutions have yet to
be devised or released, I'll wait, but before I do go ahead and attempt
an installation, I'd like to have available a compendium of the
problems in the stock distribution and what can or cannot be done about
them.
Thanks.
Randall Schulz