Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can anyone one explain what is the difference between both the versions of Ubuntu?

I installed 11.10 i386 and wrote some C code that worked fine in that platform but failed to work in 11.10 amd64 on the same machine.

After debugging with valgrind and gdb I got that I was getting segmentation fault in a call to realloc() with an argument mem_ptr and size 0 passed to it.

As I searched here i386 is referred to as 32 bit and amd64 as 64 bit.

CPU: Intel i7 2nd generation

share|improve this question
Possible duplicate?… – fossfreedom Mar 18 '13 at 11:53
Executable file which compile in i386 can not run on amd64? or Compile the c code on amd64, Executable file can not run? – eric0593 Mar 18 '13 at 12:03
I'hv already seen that question in this scenario i was testing with compiling my code on both the OS. – bikram990 Mar 18 '13 at 12:05
I tested this already i was compiling in both the scenarios. – bikram990 Mar 18 '13 at 12:06
I have more experience with RHEL in RHEL this is possible and i'hv tested too. But Not sure about ubuntu. Please refer:… – bikram990 Mar 18 '13 at 12:17

The difference between amd64 and i386 is that amd64 is 64-bit while i386 is 32-bit. This is the width (in bits) of registers available in the core.

Basically the largest number that a 32-bit CPU core can handle in one go is a little over 4.29 billion while a 64-bit core can handle a number of a bit over 18.44 billion, billion.

The cores in modern PCs are capable of behaving as either a 64-bit or a 32-bit processor depending on which version of the operating system you have installed.

64-bit code tends to run faster than 32-bit code either because it can deal with bigger numbers in on go or because the 64-bit cores have more registers so can store more things without needing to put things in external memory. Though there is no guarantee that 64-bit code will run faster if the code has not been written to take advantage of the extra features of the processor.

Compiling on a 32-bit system will produce different code than a 64-bit system. You can prove this by compiling to assembly code on the two systems. Assuming your C file is myfile.c try gcc -S myfile.c on both systems and compare myfile.s

Well written code for a 32-bit system should compile and run on a 64-bit system but not all code is well written. Many programmers make assumptions about the system that may not be true: such as register width or byte order.

Without access to your source code it's difficult to see what the problem is but a segmenation fault indicates that an attempt has been made to access memory that does not belong to the program. This may, for example, indicate that mem_ptr is a 32-bit pointer which is fine on a 32-bit system but needs to be a 64-bit pointer on a 64-bit system.

share|improve this answer
i'll check it and come back upon this... Thankx – bikram990 Mar 19 '13 at 5:45
The realloc(mem_ptr, 0) function is freeing memory previously allocated with malloc, calloc, etc. If that pointer has been corrupted in any way then you are trying to free memory you don't own and this generates a segmentation fault – Warren Hill Mar 19 '13 at 8:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.