digitalmars.D - Compiling nedmalloc w/ DMC
- Craig Black (20/33) Jan 05 2007 I know some D users are interested in nedmalloc so I thought I would pos...
- Craig Black (11/14) Jan 05 2007 After talking with Niall some more, we found that we could get rid of th...
- Sean Kelly (12/31) Jan 05 2007 I'm not sure if this helps, but VC8 declares this function in WinBase.h
- zz (16/21) Jan 08 2007 Here is a dirty solution for compiling nedmalloc with DMC.
- Georg Wrede (4/33) Jan 08 2007 I' love to see the results of some wider tests between these two.
- zz (6/12) Jan 09 2007 Just download nedmalloc from
I know some D users are interested in nedmalloc so I thought I would post this here as well as in the C++ newsgroup. BTW, I am very impressed with nedmalloc. In my C++ code, I gained an overall performance increase of about 15% by using it. I've been talking with Niall Douglas, the author of nedmalloc about my problems with compiling it using DMC. He says the libraries are outdated. In addition to the problem posted below, it seems that DMC's kernel32.lib does not include the required functions TryEnterCriticalSection and Initialize CriticalSectionAndSpinCount. On 5 Jan 2007 at 11:33, Craig Black wrote:Sorry I didn't respond sooner. Someone told me that it didn't compileunderDMC, so to verify I had to find the time to try it myself. nedmalloc.cdoescompile, but test.c does not. It could be a problem with the Digital MarsCcompiler. Perhaps if we can figure out what the bug is, we can report it.Ormaybe there is a quick fix that you could implement to get it working. Here's the error messages I get. C:\nedmalloc>..\dm\bin\dmc test.c -w -c HeapSetInformation(win32heap, HeapCompatibilityInformation, &data, sizeof(data)); ^ test.c(228) : Error: undefined identifier 'HeapCompatibilityInformation' --- errorlevel 1 Thanks in advance.Heh, that's dirt easy! Your friend is using an old SDK which isn't defining HeapCompatibilityInformation. He can upgrade it, or else substitute 0 for it. See http://msdn2.microsoft.com/en- us/library/aa366705.aspx. Cheers, Niall
Jan 05 2007
In addition to the problem posted below, it seems that DMC's kernel32.lib does not include the required functions TryEnterCriticalSection and InitializeCriticalSectionAndSpinCount.After talking with Niall some more, we found that we could get rid of the TryEnterCriticalSection link error by adding the line #define _WIN32_WINNT 0x403 before #include <windows.h> Curiosly, this did not fix the link error with InitializeCriticalSectionAndSpinCount. After further investigation, I found that both are found in DMC's kernel32.lib. Perhaps the function parameters are different. I still think DMC may need to upgrade it's libraries. Anyone have any other ideas? -Craig
Jan 05 2007
Craig Black wrote:I'm not sure if this helps, but VC8 declares this function in WinBase.h like so: #if (_WIN32_WINNT >= 0x0403) WINBASEAPI BOOL WINAPI InitializeCriticalSectionAndSpinCount( __out LPCRITICAL_SECTION lpCriticalSection, __in DWORD dwSpinCount ); SeanIn addition to the problem posted below, it seems that DMC's kernel32.lib does not include the required functions TryEnterCriticalSection and InitializeCriticalSectionAndSpinCount.After talking with Niall some more, we found that we could get rid of the TryEnterCriticalSection link error by adding the line #define _WIN32_WINNT 0x403 before #include <windows.h> Curiosly, this did not fix the link error with InitializeCriticalSectionAndSpinCount. After further investigation, I found that both are found in DMC's kernel32.lib. Perhaps the function parameters are different. I still think DMC may need to upgrade it's libraries. Anyone have any other ideas?
Jan 05 2007
Craig Black wrote:I know some D users are interested in nedmalloc so I thought I would post this here as well as in the C++ newsgroup. BTW, I am very impressed with nedmalloc. In my C++ code, I gained an overall performance increase of about 15% by using it.Here is a dirty solution for compiling nedmalloc with DMC. Inside winnt.h add the following: typedef enum _HEAP_INFORMATION_CLASS { HeapCompatibilityInformation } HEAP_INFORMATION_CLASS; Inside winbase.h add the following: WINBASEAPI BOOL WINAPI InitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION,DWORD); compile dmc -o -DNDEBUG -DWIN32 -D_WIN32_WINNT=0x0501 test.c I commented out the if(0) and if(1) in test.c just for my test. And here are my results. Standard DMC allocator: 624583.696090 ops/sec under 2 threads. Nedmalloc allocator: 3109062.452439 ops/sec under 2 threads. Nedmalloc is 4.977816 times faster than standard. Zz
Jan 08 2007
zz wrote:Craig Black wrote:I' love to see the results of some wider tests between these two. Does there exist a "de facto standard or standard-like test for memory handling in C-like languages"?I know some D users are interested in nedmalloc so I thought I would post this here as well as in the C++ newsgroup. BTW, I am very impressed with nedmalloc. In my C++ code, I gained an overall performance increase of about 15% by using it.Here is a dirty solution for compiling nedmalloc with DMC. Inside winnt.h add the following: typedef enum _HEAP_INFORMATION_CLASS { HeapCompatibilityInformation } HEAP_INFORMATION_CLASS; Inside winbase.h add the following: WINBASEAPI BOOL WINAPI InitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION,DWORD); compile dmc -o -DNDEBUG -DWIN32 -D_WIN32_WINNT=0x0501 test.c I commented out the if(0) and if(1) in test.c just for my test. And here are my results. Standard DMC allocator: 624583.696090 ops/sec under 2 threads. Nedmalloc allocator: 3109062.452439 ops/sec under 2 threads. Nedmalloc is 4.977816 times faster than standard.
Jan 08 2007
Georg Wrede wrote:zz wrote: I' love to see the results of some wider tests between these two. Does there exist a "de facto standard or standard-like test for memory handling in C-like languages"?Just download nedmalloc from http://www.nedprod.com/programs/portable/nedmalloc/index.html and try it out with your c/c++ compiler, the test.c is included in the download. Zz
Jan 09 2007