Results 1 to 10 of 45

Thread: Why proper error handling should ALWAYS be done

Threaded View

  1. #27
    Join Date
    Aug 2006
    Beans
    196

    Re: Why proper error handling should ALWAYS be done

    Quote Originally Posted by j_g View Post
    Yep.

    But Wy, this likely has to do with the differences between the size of your swap file, and total RAM. You're probably running under a more constrained system, so you really are hitting the "low memory handling" of Linux whereas some of these other guys may have systems where their test cases don't trigger the behavior (so they assume it doesn't exist). I haven't looked at the algorithm Linux uses for figuring out how much it will over-commit. It may be that this is relative to how much swap space and RAM you have. I have not heard of a way of asking Linux what this amount would be. And even if you could, it still doesn't change the fact that malloc can return 0. (Can we please put this rumor to bed?)
    There is no algorithm for that.
    As I said in my post that had the code, it returns 0 if you ask for more than you have contiguous address space.

    Linux will overcommit memory to infinity, but malloc returns 0 when (per process) address space runs out.
    Last edited by Tuna-Fish; November 20th, 2007 at 05:31 AM.

Bookmarks

Posting Permissions

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