DanBloomberg / leptonica

Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation.
Other
1.8k stars 393 forks source link

on MSVC++ "Just ignore the custom allocator feature." #199

Open radioman opened 8 years ago

radioman commented 8 years ago

what is the reason?

DanBloomberg commented 8 years ago

what is the context?

radioman commented 8 years ago
static void *
pix_malloc(size_t  size)
{
#ifndef _MSC_VER
    return (*pix_mem_manager.allocator)(size);
#else  /* _MSC_VER */
    /* Under MSVC++, pix_mem_manager is initialized after a call
     * to pix_malloc.  Just ignore the custom allocator feature. */
    return malloc(size);
#endif  /* _MSC_VER */
}

..i mean why custom allocator is bypassed by default?

DanBloomberg commented 8 years ago

probably because it will crash otherwise

radioman commented 8 years ago

it works just fine!, and i made it thread safe, check my fork

DanBloomberg commented 8 years ago

I don't know how to check it. Perhaps you can send me a patch and a simple program with a custom allocator that verifies your statement.

radioman commented 8 years ago

https://github.com/radioman/leptonica_vs2015/commit/1c979abeb00ce377912ec3161d9aef6bbbc6b3b0