This is the mail archive of the
ecos-bugs@sourceware.org
mailing list for the eCos project.
[Bug 1001634] A code review of dlmalloc.cxx revealed severalweaknesses
- From: bugzilla-daemon at bugs dot ecos dot sourceware dot org
- To: ecos-bugs at ecos dot sourceware dot org
- Date: Fri, 27 Jul 2012 10:12:05 +0100
- Subject: [Bug 1001634] A code review of dlmalloc.cxx revealed severalweaknesses
- Auto-submitted: auto-generated
- References: <bug-1001634-13@http.bugs.ecos.sourceware.org/>
Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001634
--- Comment #1 from Bernd Edlinger <bernd.edlinger@hotmail.de> 2012-07-27 10:12:03 BST ---
This is a test code to demonstrate the very slow performance
of the current implementation. The parameter k is the number
of kilobytes to use for the test.
The execution time of memtest(n) = O(n^2) without the patch.
When the patch is applied the execution time will be O(n).
#include <malloc.h>
void memtest(unsigned k)
{
unsigned i;
void **p,**q;
p=q=malloc(504);
for (i=0; i<k; i++)
{
q=*q=malloc(504+4*(i%16));
}
*q=0;
q=p;
for (i=0; i<k; i++)
{
void **n=*q;
q=*q=*n;
free(n);
if (!q || !*q) q=p;
}
free(p);
}
--
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.