wyrd Posted August 24, 2003 Posted August 24, 2003 String str = null; I forget how much memory a pointer takes.. is it 2 bytes? And 1024 bytes per meg right? Quote Gamer extraordinaire. Programmer wannabe.
*Experts* Volte Posted August 24, 2003 *Experts* Posted August 24, 2003 I'm fairly sure pointers are 4 bytes. And yes, 1MB is 1024 bytes. Quote
wyrd Posted August 24, 2003 Author Posted August 24, 2003 (edited) Erk. *grabs heart in near heart attack* 4?! :eek: Holy smokes. I thought pointers just stored a 16 bit address... it's 32? That's crazy. EDIT: Err.. and speaking of which.. bits -> bytes -> kilobytes -> megs -> gigs I think we were both wrong. Wouldn't it be 8 bits to a byte, 1024 bytes to a kilobyte, 1024 kilobytes to a meg and 1024 megs to a gig. So 1,048,576 bytes to a meg. In which case what I was worried about doesn't matter. I was worried about a large array of reference types taking up a huge amount of memory. But perhaps not; Assuming 4 bytes per reference, that's 524,288 references per meg (1048576 / 4). What I was previously thinking was 256 references per meg (1024 / 4). *blink* I guess I was worrying for nothing. ;) Edited August 24, 2003 by wyrd Quote Gamer extraordinaire. Programmer wannabe.
*Experts* Volte Posted August 24, 2003 *Experts* Posted August 24, 2003 Oops I dunno what I was thinking.... 1024^1 bytes = 1 KB 1024^2 bytes = 1 MB 1024^3 bytes = 1 GB etc... Also, you could be right about the 16-bit pointers.. I just thought pointers were 32-bit. 65535 bytes available for pointers just doesn't seem reasonable. Quote
wyrd Posted August 24, 2003 Author Posted August 24, 2003 Heh.. well I suppose this is what I get for not keeping the book I used in Assembly class. I'm sure someone will come along and set this whole thing straight. ;) Quote Gamer extraordinaire. Programmer wannabe.
aewarnick Posted August 24, 2003 Posted August 24, 2003 I sure hope so. I've been wondering the same thing. If it is just 2 bytes I'll have to change some of my code around. Quote C#
Administrators PlausiblyDamp Posted August 24, 2003 Administrators Posted August 24, 2003 Pointers should be specific to the OS architecture. In a 32-bit version of windows a pointer needs to be able to address 4G of ram - therefore 32 bits long. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Hamburger1984 Posted August 24, 2003 Posted August 24, 2003 ...and the thing with storing a large amount of data in an array... why don't you use a MemoryStream - maybe it does what you're looking for?! Andreas Quote
wyrd Posted August 24, 2003 Author Posted August 24, 2003 Pointers should be specific to the OS architecture. In a 32-bit version of windows a pointer needs to be able to address 4G of ram - therefore 32 bits long. Ah, that would explain it. Gah, now I remember why I thought they were 16 bits. In assembly class we built programs built off of the 16 bit architecture to make things easier. Quote Gamer extraordinaire. Programmer wannabe.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.