Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

reflex

macrumors 6502a
Original poster
May 19, 2002
721
0
I've noticed that Xcode 3 by default runs as a 32 bit app in Leopard, so I switched that option off and started it as a 64 bit app. Then I opened Activity Monitor to see if it would tell me that it's in 64 bit mode (which it did).

While doing this, I noticed that Xcode used (or reserved) about 35GB of virtual memory (yes, gigabytes). So I put it back in 32 bit mode, and it only used 1GB of virtual memory.

Not that I care much about this difference in practice, but I do wonder why there would be this big a difference between the two. Does anyone have any idea about this?
 

Cromulent

macrumors 604
Oct 2, 2006
6,817
1,102
The Land of Hope and Glory
I've noticed that Xcode 3 by default runs as a 32 bit app in Leopard, so I switched that option off and started it as a 64 bit app. Then I opened Activity Monitor to see if it would tell me that it's in 64 bit mode (which it did).

While doing this, I noticed that Xcode used (or reserved) about 35GB of virtual memory (yes, gigabytes). So I put it back in 32 bit mode, and it only used 1GB of virtual memory.

Not that I care much about this difference in practice, but I do wonder why there would be this big a difference between the two. Does anyone have any idea about this?

Because it needs to load the 64bit versions of all the frameworks it uses. Plus because it is 64bit certain variables are twice the size. Running Xcode in 64bit mode sounds pretty pointless if you ask me. Why would you be needing Xcode to address more than 4GBs or real RAM?

Also virtual memory is meaningless it is what is potentially allocated to an application not necessarily what an application is using.
 

reflex

macrumors 6502a
Original poster
May 19, 2002
721
0
I don't intend to run Xcode in 64 bit mode, it was just a little experiment :)

But wouldn't the 32 bit version need to load frameworks as well? In other words, a difference of 34GB seems pretty steep.

Not that I'm worried or anything, just curious.
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,566
I don't intend to run Xcode in 64 bit mode, it was just a little experiment :)

But wouldn't the 32 bit version need to load frameworks as well? In other words, a difference of 34GB seems pretty steep.

Not that I'm worried or anything, just curious.

Virtual memory sizes seem to be absolutely meaningless. For example, how much stack space would you give every thread by default? You've got 16 billion gigabyte address space, so you might as well give 1 GB virtual space to each thread; that means you run out of memory once you created 16 billion threads :D Virtual memory costs nothing. So with 34 threads, 34 GB virtual memory is used. Nobody cares (except users who see these huge numbers and get worried for no reason).
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,566
Running Xcode in 64bit mode sounds pretty pointless if you ask me. Why would you be needing Xcode to address more than 4GBs or real RAM?

It should be running a bit faster because it has twice as many registers on Intel 64 bit than on Intel 32 bit. But that would only make a difference if the compilers are 64 bit.
 

reflex

macrumors 6502a
Original poster
May 19, 2002
721
0
Makes me think I should try to make a 64 bit app that runs out of memory some time :)
 

iSee

macrumors 68040
Oct 25, 2004
3,540
272
Code:
    malloc(1000000000000000)

Or, for more drama, do it 1K at a time:

Code:
while (1)
    malloc(1024);

I double-dog dare you to run this on your Mac :eek:
 

Catfish_Man

macrumors 68030
Sep 13, 2001
2,579
2
Portland, OR
Actually, I'm pretty sure I know at least some of what's happening here.

In 32 bit mode, both the kernel and the application are given a full 32 bits of address space, forcing a flush of the mapping from virtual space to real space (see http://en.wikipedia.org/wiki/Translation_Lookaside_Buffer ) each time the kernel has to do something.

In 64 bit mode, the kernel still gets its 32 bits of address space, and the application then gets everything *after* that.

However, that only explains an additional 4GB or so. Not sure where 35 is coming from. Regardless, in 64 bit mode you've got way more than enough address space to spare.
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,566
Well that is not hard to do. Most people are still limited by rather small amounts of RAM.

Actually, the 64 bit software would be limited by the size of your hard drive and your patience. The amount of _fast_ memory that you have is limited by RAM, beyond that it just goes a lot, lot slower. (I know people who used machines with 16 GB of RAM a few years ago for software that took days to get its results; they turned off virtual memory because that made everything about five percent faster, and if the 16 GB wasn't enough, swapping to the hard drive was so slow that it was pointless).
 

guest7

macrumors newbie
Oct 18, 2008
2
0
Urgent Query

how can i change the xcode from 32 bit to 64 bit. I am getting a error in running a program :

(5209) malloc: *** mmap(size=2097152) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug

How can i solve this error..

i am using MAC 10.5 , Xcode 3.0

Please help!

Thanks
 

Morn

macrumors 6502
Oct 26, 2005
398
0
64 bit is a more efficient instruction set that has benefits beyond just memory size.
It's faster. It's a new version of x86 with some of it's worst bottlenecks removed.
However.... this doesn't really help xcode either... as xcode running as 64 bit starts 32bit processes of gcc when compiling. And gcc doesn't seem to benefit from 64 bit either.
But here, some benchmarks on linux, good way to compare 32bit and 64bit.
http://art-blog.no-ip.info/files/amd64vsi386.pdf

Very impressive. Video encoding is 20% faster, Image editing 105% faster, 3D rendering is 56% faster Firefox is 6% faster on javascript and 24% faster on CSS and apache is 40% faster.
I'm quite annoyed at how few apps are out in 64 bit versions.
 

foidulus

macrumors 6502a
Jan 15, 2007
904
1
Stupid question

but how do you tell if an application is in 64 bit mode or not?

Just noticed that XCode is one of the few that have 64 bit PPC binaries as well(well, Chess.app does too :p)
 

Catfish_Man

macrumors 68030
Sep 13, 2001
2,579
2
Portland, OR
I can't pinpoint *what* is wrong with that benchmark, but something definitely is. Those are very very abnormal results to get. My guess would be that the 64 bit version of some apps are targeting new processors, since only new processors are 64 bit; that would allow them to use SSE2 and such. That's just a wild guess though, could be totally off the mark.
 

Catfish_Man

macrumors 68030
Sep 13, 2001
2,579
2
Portland, OR
30% is on the high side of what I'd expect, but not unreasonable. My own tests have shown 15-20% is a reasonable expectation. >100% though? Something is weird there.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.