caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Ocaml crash in windows due to running out of memory
Date: Tue, 26 Nov 2013 10:02:48 +0100	[thread overview]
Message-ID: <20131126090248.GA20512@frosties> (raw)
In-Reply-To: <20131125135527.GA23794@notk.org>

On Mon, Nov 25, 2013 at 02:55:27PM +0100, Adrien Nader wrote:
> Hi,
> 
> On Mon, Nov 25, 2013, Goswin von Brederlow wrote:
> > On Wed, Nov 20, 2013 at 09:56:11PM +0100, Adrien Nader wrote:
> > > Hi,
> > > 
> > > On Wed, Nov 20, 2013, Amogh Margoor wrote:
> > > > Hi,
> > > > The Ocaml version I am facing problem with is 3.12.1.
> > > > Regards,
> > > > Amogh
> > > > 
> > > > From: Amogh Margoor
> > > > Sent: Wednesday, November 20, 2013 4:19 PM
> > > > To: 'caml-list@inria.fr'
> > > > Subject: Ocaml crash in windows due to running out of memory
> > > > 
> > > > Hi,
> > > > We have memory intensive application coded in Ocaml, which crashes on Windows 7 when it runs out of memory instead of throwing an exception.
> > > > Is that a known issue ?
> > > 
> > > What is the exception and how much memory is your application using at
> > > that moment?
> > 
> > Many kernels only allocate address space on malloc() and assign pages
> > only on use. They also support over commit of memory. Meaning
> > applications can allocate more memory than the system has under the
> > assumption that they won't actually use it all (or that maybe some
> > memory will be freed before the apps actually use the memory).
> > 
> > Due to that in many kernels malloc() basically never fails but when
> > you use the memory and the kernel can't find any page to assign to it
> > you get a segfault and your program crashes. You only get the
> > exception if the malloc() fails.
> > 
> > Now I'm not sure how windows actualy handles this but it sounds like
> > it allows over commit.
> 
> As far as I know, it doesn't do overcommit. Also, I doubt that would
> change anything: if you exhaust your address space, you cannot receive a
> pointer to some place since it would collide with some of your already
> assigned space.
> On 32b, allocations have to fail once you reach 2GB of memory (or 3GB
> depending on some settings). That said, such a scenario should probably
> trigger an exception but so far this is just an hypothesis which cannot
> be confirmed until we roughly know the memory usage.

But what if I only have 512MB ram? I can still malloc(1G), get a
pointer back and then get segfaults when I use too much of it. On
64bit systems the address space also greatly exceeds any amount of
physical ram you might have.

My reply was just an explanation of why ocaml would crash rather than
throw an out of memory exception.

MfG
	Goswin

  parent reply	other threads:[~2013-11-26  9:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20 10:52 Amogh Margoor
2013-11-20 20:56 ` Adrien Nader
2013-11-25 13:01   ` Goswin von Brederlow
2013-11-25 13:55     ` Adrien Nader
2013-11-26  6:53       ` Florian Hars
2013-11-26  9:14         ` Goswin von Brederlow
2013-11-26  9:24         ` Adrien Nader
2013-11-26  9:02       ` Goswin von Brederlow [this message]
2013-11-26  9:22         ` Adrien Nader
  -- strict thread matches above, loose matches on Subject: below --
2013-11-20 10:48 Amogh Margoor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131126090248.GA20512@frosties \
    --to=goswin-v-b@web.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).