[Haskell-cafe] Need help with very simple C++ FFI call

Thiago Padilha tpadilha84 at gmail.com
Tue Nov 19 16:31:06 UTC 2013

On Tue, Nov 19, 2013 at 1:19 PM, Brandon Allbery <allbery.b at gmail.com> wrote:

> Also note that different memory allocators have different behaviors;
> depending on block size rounding, string length and arena accounting
> overhead, the allocated block may be larger than requested. So the malloc()
> that Python provides may possibly be returning something "accidentally"
> large enough to handle the NUL anyway. (I don't know if Python actually
> overrides/replaces the default malloc(); some other interpreters do.)

Line 14(which causes the segfault) comment says the HandleScope is
being allocated on the stack:

    // Create a stack-allocated handle scope.
    HandleScope handle_scope(isolate);

I dont know any C++. Is it possible that this line of code is
allocating something on the heap? If so could ghci have overriden
memory allocation routines in a way that would mess that allocation?

More information about the Haskell-Cafe mailing list