Crash on Windows with core.stdc.stdlib.free()

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 12 05:00:07 PST 2014


On Wed, 12 Nov 2014 12:40:30 +0000
Chris via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:

> The following causes the DLL to crash on Windows:
> 
> Input: immutable(short)* data (immutable because in separate 
> thread).
> // Later
> core.stdc.stdlib.free(cast(short *)data);
> 
> (short* data is provided by the C library, where the memory is 
> allocated)
> 
> On Linux it works fine and never crashes, in the Windows DLL it 
> randomly causes an access violation in memory (both read and 
> write). Note that it doesn't crash immediately, it goes on for a 
> while, but sooner or later it crashes. If I comment out this 
> line, everything works fine. However, if I don't free the memory, 
> I'll have a memory leak. Any hints/advice/guesses?
p.s. i mean "different C runtimes".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20141112/6332d513/attachment.sig>


More information about the Digitalmars-d-learn mailing list