test_allocator v0.0.1 - don't leak memory in your std.experimental.allocator using code

Atila Neves via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Fri Dec 16 13:03:11 PST 2016


So you decide to use std.experimental.allocator for your memory 
allocations. Let's say you're as paranoid as me about getting the 
allocations right. How do you know you're not leaking memory now 
(no GC safety net)?. Or worse, deallocating memory you shouldn't? 
The program didn't crash, but you never do know...

Enter the test allocator here:

http://code.dlang.org/packages/test_allocator

Run your code through that little guy in a unittest build and 
worry no more. It throws an AssertError in the destructor if 
there's a memory leak and also if you try and deallocate memory 
that it doesn't know about. It's backed by Mallocator because 
then you can also use valgrind or address sanitizer to catch even 
more bugs.

Atila


More information about the Digitalmars-d-announce mailing list