Re: NULL pointer or objptr should not pass the validity check.

Matthew Fluet <[email protected]> Thu, 16 May 2013 14:44:38 -0400
Newsgroups gmane.comp.lang.ml.mlton.devel
Message-ID <CAMrhFL6kZLRrWkuC4rXM0655S2LL+shGvH9pPmc-PMbWpCmGWg@mail.gmail.com>
On Mon, May 13, 2013 at 2:29 AM, 吴佳森 <[email protected]> wrote:
> You are right, Matthew. the NULL point should not have been in the heap.
>
> I noticed after my temporary fix, the executable at last raise a exception
> says not enough memory to create a heap. Therefore I then made the runtime
> print each GC_mmapAnon and GC_release.

The runtime will print a lot of GC related messages by running an
executable with "@MLton gc-messages --".

> The requested heap size goes from 18M
> to 500M at last. Note that I implement GC_mmapAnon() with malloc(). I
> realized that it is a special feature of my currently using platform. The
> freed piece of memory are directly put back to the system nor they can be
> used to satisfied by next request. The C runtime keep all those pieces of
> heaps and finally run out of memory.

That could make sense; if the runtime never frees any allocated
memory, then you will likely run out of available memory.

> After I telling the C runtime to always to put back those freed storage, the
> running out of memory error goes aways. And removing my temporary fix, the
> executable can still successfully run, showing that the NULL point does not
> exist on the heap when there are sufficient memory.

The confusing thing about this is that whether or not the runtime
frees previously allocated heaps, that shouldn't change the contents
of the "current" heap.

------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
MLton-devel mailing list
[email protected]; [email protected]
https://lists.sourceforge.net/lists/listinfo/mlton-devel