locked
malloc failed under Windows 7 64 bits RRS feed

  • Question

  • Hi,

    My application is compiled in 32 bits under Windows 7 - 64 bits. So, I should be able to allocate up to 3GB I think ?

    The problem is that in the task manager the application go up to 1Gb and later failed to allocate memory !

    I try to manage the memory as best as possible... but without result !

    The problem is that my software crash due to this... and if it is not my software it happend in other DLLs I use !

    I have think about memory leak, memory fragmentation too ! But there is no way to check this I think easily :-P


    PL01

    Friday, February 17, 2012 11:14 AM

Answers

  • I have set it and it write thousands of line in the output !! Just small sizes of maximum 99 bytes !

    But what can I do with this and how can I fidn where it happend ?

    Try here: "Memory Leak Detection Enabling "
    http://msdn.microsoft.com/en-us/library/e5ewb1h3(v=vs.80).aspx

    Dave

    • Marked as answer by Rob Pan Thursday, March 1, 2012 9:20 AM
    Friday, February 17, 2012 4:46 PM

All replies

  • My application is compiled in 32 bits under Windows 7 - 64 bits. So, I should be able to allocate up to 3GB I think ?

    Unlikely in reality - as you're finding.

    If your application really has to have such an enormous memory
    allocation it needs to be a 64-bit application.

    I have think about memory leak, memory fragmentation too ! But there is no way to check this I think easily :-P

    It depends what in particular is leaking.

    The debug VC++ run-time has memory leak detection for default heap
    allocated memory. Have a look at "How to: Enable Memory Diagnostics"
    http://msdn.microsoft.com/en-us/library/e009249y.aspx for starters.

    Dave

    Friday, February 17, 2012 12:02 PM
  • Right Dave,

    But using 2GB will be enough, today memory grow up to 1GB and then crash !

    Unfortunately I can't use AfxEnableMemoryTracking because my application is not a MFC one !

    Thanks

    Krys


    PL01

    Friday, February 17, 2012 1:20 PM
  • But using 2GB will be enough, today memory grow up to 1GB and then crash !

    Unless you go to great efforts, I think 1GB is likely to be the max on
    a 32-bit OS.

    Unfortunately I can't use AfxEnableMemoryTracking because my application is not a MFC one !

    You don't need an MFC application.

    In a service project I worked on I have the following line near the
    start of the program:

    _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );

    Dave

    Friday, February 17, 2012 2:09 PM
  • The /LARGEADDRESSAWARE linker option should be set. It would allow 32-bit apps to access upto 4GB on x64 OS.

    http://msdn.microsoft.com/en-us/library/wz223b1z(v=vs.90).aspx

    But, you should really use tools to identify leaks (if the memory consumption is due to leaks).

    http://msdn.microsoft.com/en-us/library/dd744766(v=vs.85).aspx


    --Jag

    Friday, February 17, 2012 3:30 PM
  • Thanks Dave,

    I have set it and it write thousands of line in the output !! Just small sizes of maximum 99 bytes !

    But what can I do with this and how can I fidn where it happend ?

    Thx


    PL01

    Friday, February 17, 2012 3:32 PM
  • I have set it and it write thousands of line in the output !! Just small sizes of maximum 99 bytes !

    But what can I do with this and how can I fidn where it happend ?

    Try here: "Memory Leak Detection Enabling "
    http://msdn.microsoft.com/en-us/library/e5ewb1h3(v=vs.80).aspx

    Dave

    • Marked as answer by Rob Pan Thursday, March 1, 2012 9:20 AM
    Friday, February 17, 2012 4:46 PM
  • Hi,

    I have a similar problem.  My app is 32-bit.  It works fine under XP32 and W7-32 but I get a "memory allocation failure" under w7-64.  What other information is needed?

    K

    Wednesday, April 4, 2012 6:38 AM