I'll look into it and see what the problem is. Sander
> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: 10 May 2001 12:45 > To: [EMAIL PROTECTED] > Subject: cvs commit: apr/test testmem.c > > > dreid 01/05/10 03:45:04 > > Modified: test testmem.c > Log: > This adds Sanders suggestion of testing the reset for the > tracking memory > system. This also exposes a problem in that code where free is > called twice > for the same piece of memory, generating a segfault. Using > some extra debugging > This is what I see... > > Tracking Memory > Creating the memory area............................OK > Creating 10 lumps of memory, each 1024 bytes........OK > Writing to the lumps of memory......................OK > Check what we wrote.................................OK > About to reset the tracking memory.................. > calling free on 800259a8 > calling free on 80025598 > calling free on 80025598 > > I don't have tim to investigate in more detail at the moment. > > NB this will segfault, but it's being committed to allow people to > see the problem themselves :) > > Submitted by: Sander Striker <[EMAIL PROTECTED]> > Reviewed by: David Reid <[EMAIL PROTECTED]> > > Revision Changes Path > 1.2 +18 -4 apr/test/testmem.c > > Index: testmem.c > =================================================================== > RCS file: /home/cvs/apr/test/testmem.c,v > retrieving revision 1.1 > retrieving revision 1.2 > diff -u -r1.1 -r1.2 > --- testmem.c 2001/05/09 17:46:18 1.1 > +++ testmem.c 2001/05/10 10:45:00 1.2 > @@ -68,11 +68,11 @@ > > #define LUMPS 10 > #define LUMP_SIZE 1024 > +char *ptrs[LUMPS]; > > static void do_test(apr_memory_system_t *ams) > { > int cntr,cntr2; > - char *ptrs[LUMPS]; > > printf("\tCreating %d lumps of memory, each %d bytes........", > LUMPS, LUMP_SIZE); > @@ -104,7 +104,12 @@ > } > } > } > - printf("OK\n"); > + printf("OK\n"); > +} > + > +static void do_free(apr_memory_system_t *ams) > +{ > + int cntr; > > printf("\tFreeing the memory we created......................."); > for (cntr = 0;cntr < LUMPS;cntr ++){ > @@ -133,7 +138,8 @@ > printf("OK\n"); > > do_test(ams); > - > + do_free(ams); > + > printf("Tracking Memory\n"); > printf("\tCreating the memory area............................"); > if (apr_tracking_memory_system_create(&ams2, ams) != APR_SUCCESS){ > @@ -143,7 +149,15 @@ > printf("OK\n"); > > do_test(ams2); > - > + printf("\tAbout to reset the tracking memory..................\n"); > + if (apr_memory_system_reset(ams2) != APR_SUCCESS){ > + printf("Failed.\n"); > + exit(-1); > + } > + printf("OK\n"); > + do_test(ams2); > + do_free(ams2); > + > printf("Trying to destroy the tracking memory > segment..............."); > if (apr_memory_system_destroy(ams2) != APR_SUCCESS){ > printf("Failed.\n"); > > > > >
