CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Is it possible to have new allocate more than 4Gigs?

    [Read subject line]

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Is it possible to have new allocate more than 4Gigs?

    Dunno, never tried that. Afraid you just cannot address within the range as in x86 architecture the whole process address space is 4G only.

    PS. Is it possible to have such a need?
    Best regards,
    Igor

  3. #3
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: Is it possible to have new allocate more than 4Gigs?

    Quote Originally Posted by Igor Vartanov View Post
    Dunno, never tried that. Afraid you just cannot address within the range as in x86 architecture the whole process address space is 4G only.

    PS. Is it possible to have such a need?
    To answer your question, then no, there'll probably be no reason for that much memory (yet). And I agree that a 32-bit process cannot address that much space. I'm thinking about future porting to x64 though.

    I'm also always perplexed when a Windows API returns the result as a 64-bit LONGLONG variable and I have to cast it to a 32-bit LONG. Example is a file size. So, I thought, to save myself a hassle of dealing with this bottle neck in the future and start using 64-bit memory management now.

    (You know, back in a day when all they had were 16-bit CPUs no one thought that a gigabyte of memory was even possible.)

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Is it possible to have new allocate more than 4Gigs?

    Considering the moment of appearance of 486 CPU and contemporary RAM sizes afraid you should wait at least 3-4 years until you could afford such an allocation without any noticeable impact on OS. Hope that time will be enough to get some certain solution to your current perplexing.
    Best regards,
    Igor

  5. #5
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: Is it possible to have new allocate more than 4Gigs?

    Quote Originally Posted by Igor Vartanov View Post
    Considering the moment of appearance of 486 CPU and contemporary RAM sizes afraid you should wait at least 3-4 years until you could afford such an allocation without any noticeable impact on OS. Hope that time will be enough to get some certain solution to your current perplexing.
    I don't think so, Igor. For instance, the main Adobe After Effects CS5 process running in x64 address space can easily allocate 75% of my 8GB RAM. And Windows 7 runs fine at that.

  6. #6
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Is it possible to have new allocate more than 4Gigs?

    Then once your mind is already set, just write a couple of code lines, build that for x64 and see if it works. I believe this is not your first time you get an answer of the sort, as this very common in the community. Nobody can know everything.

    On this reason I accustomed always do this step before asking. And you know, I never had a reason to ask anybody after.
    Best regards,
    Igor

  7. #7
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: Is it possible to have new allocate more than 4Gigs?

    Quote Originally Posted by Igor Vartanov View Post
    Nobody can know everything.

    On this reason I accustomed always do this step before asking.
    Igor, I understand that. Unfortunately most times I don't have enough hours in a day to try it out ... and yes, I might be abusing this community by hoping that someone has already done that and may post it here and save me time. Because that is what I do when I browse through this forum and if I see something that someone is asking and I know how to help them, I do respond and issue my advice. On the other hand, I do not comment if I don't know the answer...

  8. #8
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Is it possible to have new allocate more than 4Gigs?

    Why do you need to have so much memory in 1 malloc ?

  9. #9
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Is it possible to have new allocate more than 4Gigs?

    Quote Originally Posted by ahmd View Post
    [Read subject line]
    Not on 32-bit platforms. But it can on 64-bit, yes.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  10. #10
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Is it possible to have new allocate more than 4Gigs?

    most times I don't have enough hours in a day to try it out
    Yep, this is very common. People tend to survive this their own ways.
    I might be abusing this community by hoping
    You get it wrong way, I believe. It never was about abusing or something. It's just about obvious difference between "hoping somebody knows, possibly without any clue whether I should trust that knowing" and "knowing by experiment of my own".

    On the other hand, I do not comment if I don't know the answer...
    Might be good for you. Or might be not. As I already said, you get this forum mostly like "answering machine". While I do not. I comment when I feel like that. Hope this seems not very abusing... and you excuse my imperfection.
    Best regards,
    Igor

  11. #11
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: Is it possible to have new allocate more than 4Gigs?

    IMO, if there is more than 4GB attached (memory extensions) then it can be allocated even on 32 bit system. I think the limit is 2^36, if allocated with help of memory mapped files then this works, server datacenter edition is needed to have this I guess.
    Last edited by Krishnaa; July 22nd, 2010 at 05:36 AM.
    Regards,
    Ramkrishna Pawar

  12. #12
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: Is it possible to have new allocate more than 4Gigs?

    Quote Originally Posted by Skizmo View Post
    Why do you need to have so much memory in 1 malloc ?
    Quote Originally Posted by ahmd
    I'm also always perplexed when a Windows API returns the result as a 64-bit LONGLONG variable and I have to cast it to a 32-bit LONG. Example is a file size. So, I thought, to save myself a hassle of dealing with this bottle neck in the future and start using 64-bit memory management now.

    Quote Originally Posted by cilu View Post
    Not on 32-bit platforms. But it can on 64-bit, yes.
    I did an experiment with memory allocation and it seems like there's a limit in x86 address space. For some reason on my Windows 7 x64 system with 8GB of RAM I was able to allocate 0x5FFFFFFF bytes but for 0x6FFFFFFF bytes it failed. I also tried calling HeadAlloc and VirtualAlloc with the same negative result. So I guess it pays to code in x64 environment after all.

    Quote Originally Posted by Igor Vartanov View Post
    You get it wrong way, I believe. It never was about abusing or something. It's just about obvious difference between "hoping somebody knows, possibly without any clue whether I should trust that knowing" and "knowing by experiment of my own".
    Yes, I'm with you on that one. What I'm hoping for is to learn something that I don't already know. And, speaking of some flaky code off the web, I never take it at a face value and copy it one-to-one into my project. In most code samples just the idea is what matters.

    Quote Originally Posted by Krishnaa View Post
    IMO, if there is more than 4GB attached (memory extensions) then it can be allocated even on 32 bit system. I think the limit is 2^36...
    Hah, this is one of those cases that I've never heard of. What are you talking about? It would be nice if it worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured