On Wed, Feb 11, 2004 at 08:50:03AM -0800, Ovid wrote:
> I've a problem in testing Inline::C.  In the module
> AI::NeuralNet::Simple,  I do some work allocating and deallocating
> memory and I've been bitten by a bug where I wasn't allocating memory
> properly for one of my arrays.  It's fixed, but I have no idea how to
> write a test for that.  I'm also rather unclear about how to test the C
> functions.  I only have 18 tests for the module, but it needs heavy
> redesign internally (such as not using globals in C) and while testing
> through the Perl interface will catch bugs, it won't tell me where the
> bugs are.

To catch memory mistakes in C, I'd normally use something like Electric
Fence or other malloc replacement.  Basically something that replaces the
memory allocation functions with those that put in magic so that if your
program walks outside its allocated memory space it immediately pukes.

However, I don't know how these will interact with Inline::C.


-- 
Michael G Schwern        [EMAIL PROTECTED]  http://www.pobox.com/~schwern/
That which stirs me, stirs everything.
        -- Squonk Opera, "Spoon"

Reply via email to