Also, crashes with malloc() may be because of earlier bugs. If you free() an incorrect pointer, it may corrupt the heap -- causing the program to crash later instead of immediately, if you're unlucky. That can be hard to track down.
I'd say crashes in malloc() and free() are almost ALWAYS because of earlier bugs in the use of dynamically-allocated memory.
That also includes overrunning your allocated memory. If you malloc a memory segment, and write too much data to it, you'll get the same result.
A SEGV, mostly likely.
For example:
Actually, I lied - the above will probably work just fine. Why? Because malloc is required to return a pointer to memory "suitably aligned for any purpose". That means malloc implementations return bytes of memory in chunks of whatever size meets the alignment restrictions on whatever platform you're running - most likely 8 bytes.
So malloc( 1 ) will effectively return a pointer to what's most likely an empty 8-byte space in your heap.
That's just another reason why overrunning a malloc'd buffer sometimes causes problems and sometimes doesn't.
There is no issue with this piece of code (outside the useless strRoutine declaration). The problem is elsewhere. Are you sure you get a bus error and not a segmentation fault ?
Hi all
What is the qualification required by Linux/Solaris System Administrator to become a Linux/Solaris System Programmer as to gain complete knowledge on computers.
Thanks (1 Reply)
Hi,
I have not worked on Solaris 10 that much. Need some help with this. I can't seem where the file or how the file systems are mounted. Please see the /etcvfstab below.
more vfstab
#device device mount FS fsck mount mount
#to mount to fsck ... (3 Replies)
Hi all
I wonder if its possible to mount on a hp-ux server a file system that was previously mounted on a solaris 10 server. The LUN is on NetApp stoarge.
The problem on hp-ux I cannot do pvcreate on the lun (disk) because contains data.
Any help will be appreciated
FR (2 Replies)
Hi,
I am running into a some problems creating a dual boot system of 2 solaris instances using ZFS file system and I was wondering if someone can help me out.
First some back ground. I have been asked to change the file system of our server from UFS to ZFS. Currently we are using Solaris... (3 Replies)
Hi guys,
I have been using Solaris 10 virtually since a couple of weeks under VirtualBox. Now I want to run it on hardware as it doesn't seem to work well under VirtualBox, atleast to my knowledge. I have another system which I intend to run Solaris on, and it is as under.
Processor:- Intel... (1 Reply)
Solaris 10 (Sun V210) System hangs every couple of months. Have to go into ALOM to reset. I did a consolehistory report and seen this in it.
Failed to exec inetd_start method of instance svc:/network/bootps/udp:default: I/O error
WARNING: /pci@1c,600000/scsi@2 (glm0):
Resetting... (3 Replies)
Hi Friends,
I am trying to execute rsh commands from Solaris 10 system to AIX system.
When I give;
Solaris10# rsh <hostname> ls -l , it gives me an error
rshd : 0826-826 The host name for your address is not known
At the same time,
Solaris10# rsh <hostname> ---- gives me remote shell of... (25 Replies)