Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 11-17-2005, 11:51 AM   #1
LQ Newbie
Registered: Jun 2005
Distribution: Open SuSE 10
Posts: 23

Rep: Reputation: 15
calloc failures

Hi, I've been having an odd experience lately with a program I code for a Linux architecture. When allocating memory via the calloc function it for some reason seems to randomly fail when calloc calls mallopt. Most often when I view the core dump it shows in the backtrack the call to the calloc function in then two or three calls to the mallopt function in and occassionally it'll then show abort() raise() kill() calls and I'm not sure why. It happens randomly and I was wondering if anyone could shed some light on the situtation. Also the Glibc is version 2.3.4 not sure if that helps or not...
Old 11-18-2005, 10:14 PM   #2
Registered: May 2004
Location: USA
Distribution: #1 PCLinuxOS -- for laughs -> Ubuntu, Suse, Mepis
Posts: 315

Rep: Reputation: 31
check your code .. it's not system that's random .. something in your code is causing it.
good practice to print errno after system calls.
Old 11-19-2005, 06:02 PM   #3
LQ Newbie
Registered: Jun 2005
Distribution: Open SuSE 10
Posts: 23

Original Poster
Rep: Reputation: 15
fixed it

It truly was random, I modified the code so that instead of using calloc it uses malloc and modified the macro so it was stuck in a for loop until it got a valid chunk of memory and the program hasn't locked up from it and it hasn't crashed since. Either way the whole thing is odd since that code hadn't changed for 6 years before it started doing it.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
calloc returns weird address? mvorlov Programming 2 11-09-2005 07:55 AM
malloc .vs. calloc thelonius Programming 5 10-28-2005 04:50 PM
C-Program: calloc() and free() using in while xxfunkxx Programming 10 12-06-2004 09:04 PM
what is the point of calloc? Berhanie Programming 8 07-17-2004 01:21 PM
Detecting failures ph33r Linux - Networking 1 05-15-2002 02:36 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:37 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration