[prev in list] [next in list] [prev in thread] [next in thread]
List: glibc-help
Subject: Glibc 2.5 - dlsym issue in threaded app.
From: vivanov () softservecom ! com (Vitaliy Ivanov)
Date: 2008-11-05 15:18:00
Message-ID: C7E4B93E1693CA4AA0533C881F5B751E10AC6899B7 () exchangehp1 ! softservecom ! com
[Download RAW message or body]
> -----Original Message-----
> From: patofiero@gmail.com [mailto:patofiero@gmail.com] On Behalf Of
> Carlos O'Donell
>
> The GLIBC version checks are completely unnecessary. Create a static
> buffer of N bytes, and return references to this buffer on a first
> come first serve basis, clearly the first calloc call is going to be
> in the resolution of the next calloc call.
There already was a code with 16 bytes from another guys
who worked on this a long time ago.
I spent some time to get to the bottleneck of the problem.
Anyway, now I have:
...
const int extra_mem_size = 20;
static char extra_mem[extra_mem_size];
...
//-----------------------------------------------------------------------------
void * calloc(size_t num, size_t sz)
{
static bool memUsed; // Counting on default initialization to 0
if (!memUsed)
{
if(sz > extra_mem_size) {
printf("ERROR: calloc static buffer issue!!!\n");
printf("Check size of dl_action_result structure.\n");
abort();
}
memUsed = true;
memset(extra_mem, 0, sz);
return (void *) extra_mem;
};
...
Thanks for your hints.
V.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic