473,569 Members | 2,704 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

calloc interposing issue

Hi,

We've interposed malloc/calloc/realloc/memalign/valloc in our
application. While all of our application calls our own implementation
of these functions, there seems to be some issue with the dl.so shared
library (Windriver, ppc, linux 32 bit). The dl.so library defines a
function called - _dl_tls_setup and another one - _dl_deallocate_ tls.
When our application that linked in -ldl and -lpthread, was shutting
down, we saw a crash with the backtrace pointing to
_dl_deallocate_ tls. Upon further investigation we found that
_dl_tls_dealloc ate was calling 'free' which was our own implementation
(Not libc's) However, the chunk was got using malloc/calloc from
libc!!!!!. I put a breakpoint at _dl_tls_setup and found that it was
getting memory from the libc calloc.

I'm not sure how the dl library could have got calloc from libc and
free from our application. Please help!!!

thanks,
-Anil
Feb 22 '08 #1
5 2205
On 22 Feb, 10:30, reacha...@gmail .com wrote:
Hi,

We've interposed malloc/calloc/realloc/memalign/valloc in our
application. While all of our application calls our own implementation
of these functions, there seems to be some issue with the dl.so shared
library (Windriver, ppc, linux 32 bit). The dl.so library defines a
function called - _dl_tls_setup and another one - _dl_deallocate_ tls.
When our application that linked in -ldl and -lpthread, was shutting
down, we saw a crash with the backtrace pointing to
_dl_deallocate_ tls. Upon further investigation we found that
_dl_tls_dealloc ate was calling 'free' which was our own implementation
(Not libc's) However, the chunk was got using malloc/calloc from
libc!!!!!. I put a breakpoint at _dl_tls_setup and found that it was
getting memory from the libc calloc.

I'm not sure how the dl library could have got calloc from libc and
free from our application. Please help!!!

thanks,
-Anil
Feb 22 '08 #2
sorry for previous message. hit the wrong key

On 22 Feb, 10:30, reacha...@gmail .com wrote:
We've interposed malloc/calloc/realloc/
not sure what "interposed " means...
memalign/valloc
I'm not familiar with these. Are they new to C99?

in our
application. While all of our application calls our own implementation
of these functions,
I'm pretty sure that puts you firmly in implementation defined
territory.
I don't think you can (portable) redefine standard library functions.

there seems to be some issue with the dl.so shared
library (Windriver, ppc, linux 32 bit).
thats *really* implementaion defined! You need to try
a windows programming news group

<snip>
--
Nick Keighley
Feb 22 '08 #3
Nick Keighley said:
sorry for previous message. hit the wrong key

On 22 Feb, 10:30, reacha...@gmail .com wrote:
>We've interposed malloc/calloc/realloc/

not sure what "interposed " means...
"Interpositioni ng" means "replacing a library routine (typically but not
necessarily a standard library function) with your own function".

<snip>

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Feb 22 '08 #4
In article <81************ *************** *******@b29g200 0hsa.googlegrou ps.com>,
<re*******@gmai l.comwrote:
>I'm not sure how the dl library could have got calloc from libc and
free from our application. Please help!!!
You really need to ask about this on a group related to Linux;
this stuff is very OS-dependent.

-- Richard

--
:wq
Feb 22 '08 #5
Nick Keighley wrote, On 22/02/08 10:47:
On 22 Feb, 10:30, reacha...@gmail .com wrote:
<snip>
>there seems to be some issue with the dl.so shared
library (Windriver, ppc, linux 32 bit).

thats *really* implementaion defined!
As far as the standard is concerned it is undefined, so the
implementation may well not define it. In this case though I believe
that Linux does provide mechanisms to do this.
You need to try
a windows programming news group
I think you meant Linux programming group.
--
Flash Gordon
Feb 22 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3630
by: Koster | last post by:
Sorry for the re-post, but my previous question was left unanswered. I have a question about the appropriateness of calloc. Consider an array of pointers to structs which need to be allocated space on the heap, for example: typedef struct myStruct *PMYSTRUCT; struct myStruct { int i; int j;
29
40354
by: David Hill | last post by:
Is there a difference between: /* code 1 */ struct sample test; test = malloc(sizeof(struct sample)); memset(&test, 0, sizeof(test)); /* code 2 */ struct sample test; test = calloc(1, sizeof(struct sample));
16
8961
by: laberth | last post by:
I've got a segmentation fault on a calloc and I don'tunderstand why? Here is what I use : typedef struct noeud { int val; struct noeud *fgauche; struct noeud *fdroit; } *arbre; //for those who don't speak french arbre means tree.
27
4723
by: MK | last post by:
I am a newbie. Please help. The following warning is issued by gcc-3.2.2 compiler (pc Linux): ================================================================== read_raw_data.c:51: warning: assignment makes pointer from integer without a cast ================================================================== when the following piece of...
37
2537
by: Harsimran | last post by:
Can any one explain what are far pointers and what is the difference between malloc and calloc .Which is better ?
7
2293
by: pervinder | last post by:
Hi, I have a c applicaiton which uses calloc to allocate the storage from heap. A page is allocated (4096bytes) and then its used in smal small chunks on need. It works fine till some n number of pages are alloacted and used. But it fails to allocate a fresh page of 4096 after some m times when the prev. block gets exhausted and new...
40
2483
by: boris | last post by:
Hi! I'm seeking some answers about what seems to be a memory leak. I have a loop that looks much like this: double *largeArray = (double*) calloc(); for (...) { printf("iteration #...\n"); for (...) { double *foo = (double*) calloc();
14
7464
by: Roka100 | last post by:
Hi all, I tried 2 programs : #include <stdio.h> #include <string.h> 1, int main(void){ char *str = NULL;
37
5101
by: deepu | last post by:
Please reply...
0
7698
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7970
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.