I have an uClibc wrapper library which does an implementation of malloc(), 
realloc() and free() that embedded some statistics gathering about memory 
allocations and then use the real malloc(), realloc(), free() definition of 
uClibc to perform the memory allocationand itself only embed the necessary 
logic to implement the statistics gathering function. The wrapper library is 
statically linked with the application. Please note that the intention of the 
wrapper is to hook and gather statistics only those calls which are going out 
of application.code snippet: uclibcmalloc = dlsym(RTLDNEXT, “malloc”); 
uclibcrealloc = dlsym(RTLDNEXT, “realloc”); uclibcfree = dlsym(RTLDNEXT, 
“free”);void * malloc(sizet sz) { … p = uclibcmalloc(sz); … return p;} void * 
realloc(void * oldp, sizet sz) {… p = uclibcrealloc(oldp, sz); … return p;} 
void free(void * p) { … uclibcfree(p); } malloc() and free() are working 
perfectly. But when realloc() is called the problem arises. The 
 uClibc realloc()internally calls malloc() for allocating the new pointer and 
free() to free the old pointer. When this malloc() and free() are getting 
called they are coming to my wrapper library implementation.I am expecting that 
the internal calls to malloc(), free() from uclibc should go to uclibc 
implementation directly, but it is not happening that way. Please advice, how 
to get rid of this issue. I want uClibc internal function calls should go to 
uClibc implementation only. Regards,AviDear uclibc ! Get Yourself a cool, short 
@in.com Email ID now!
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to