在 Fri, 05 Jun 2009 08:51:25 +0800,Jarrett Billingsley <jarrett.billings...@gmail.com> 写道:

On Thu, Jun 4, 2009 at 8:50 PM, Jarrett Billingsley
<jarrett.billings...@gmail.com> wrote:


http://www.digitalmars.com/d/archives/digitalmars/D/nedmalloc_47148.html
http://lists.puremagic.com/pipermail/digitalmars-d/2007-January/013224.html

Oops, meant to post this link instead:

http://www.digitalmars.com/d/archives/digitalmars/D/Compiling_nedmalloc_w_DMC_46240.html

Even if you can compile it to binary, it still won't run correctly because of the dmc codegen problem.

I will attach a compilable nedmalloc source, corresponding compile batch, and a simple test app. In two post of this thread because of the attachment size limitation of 51k.

The bug is:

malloc.c.h:1870 interlockedcompareexchange(&malloc_global_mutex_status, -1, 0) == 0) {
004020f7: 837dfc00                cmp dword [ebp-0x4], 0x0
004020fb: 7530 jnz 0x40212d init_malloc_global_mutex malloc.c.h:1875
004020fd: 6a00                    push 0x0
004020ff: 6aff                    push 0xff
00402101: 68b8e74200              push dword 0x42e7b8
00402106: e811100200 call 0x42311c __InterlockedCompareExchange

*Notice:

The prototype of the func for last two params are longs. So it should be:

push 0x00000000
push 0xffffffff

not:
push 0x0
push 0xff

--
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/

Attachment: nedmalloc.7z.001
Description: Binary data

Reply via email to