- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: SIGBUS problem
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2002 05:21 AM
12-06-2002 05:21 AM
SIGBUS problem
I am having problem running my application written in C on HP-UX 11.
The process gets SIGBUS error after call to function (f1). The back trace of core file recursively shows caller 'f1' function.
There is no memory corruption or such error before call to f1.
What could be the problem here?
Does memory allocation from cause this problem?
Thanks
Rohan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2002 08:15 PM
12-08-2002 08:15 PM
Re: SIGBUS problem
Some things to look for:
1. Using a pointer that hasn't been initialised - trying to read/write to an invalid or NULL memory address.
2. Improper pointer arithmetic - for example, accessing *ptr [a]+1 instead of *ptr[a+1]
3. Overflowing arrays.
Rational's purify is a good tool to locate these kind of errors. Alternatively, recompile your code with the +g and without the -O option (make sure you don't strip the exe after compiling) and then use a good debugger like gdb to figure out where the problem lies.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2002 08:22 PM
12-08-2002 08:22 PM
Re: SIGBUS problem
You'll have to go though your ptogram more closely. Likely chances are that a unintilized pointer is being used. That might be that you havent allocated any memory for a pointer.
Cheers
Rajeev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2002 02:32 AM
12-09-2002 02:32 AM
Re: SIGBUS problem
One more comment. There is one more situation extremally difficult to debug, very often not mentioned: using deallocated memory.
Consider code:
{
char *buffer = malloc( BUFFER_SIZE );
free( buffer );
/***/
/* do something with buffer (!!!) */
}
This very rarelly generates SIGSEGV! Why?
Memory management doesn't return every piece of memory back to the system immediatelly. Instead it keaps a track of free memory blocks for reuse. So the memory from the system's point of view is allocated.
However for managing free memory lists you need a memory (at least to write pointers for the blocks). But there is no problem - we have a memory that is to be deallocated - why not to use it?
Concluding - freed memory is not deallocated, but collected into free blocks list for reusage. This memory IS USED by memory manager INTERNALLY. If you destroy it you won't be rejected by the system, as from it's point of view everything is OK. But it is likelly that your next try to allocate memory, while checking free blocks, will end on block with destroyed internal data and then - everything can happen.
Check it very carefully.
Good luck
Adam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2002 02:53 AM
12-09-2002 02:53 AM
Re: SIGBUS problem
Thanks a lot for your reply/suggestions.
Actualy, I traced down the cause of problem to a local variable in 'f1'. It is a char str[128][1024].
When I reduced 'str' to str[10][1024], the application started working.
What I am wondering is, instead of getting stack overflow why am I getting SIGBUS error?
Any clues regarding this?
Even though I increased the maxssiz to 32MB, the str[128][1K] gave problem.
Also, is there way to find current usage of stack?
Thanks
Rohan