Hi, I'm building an n x n 2D array.
I've declared the structure: int ** aoa; I've allocated the memory: Newz(100, aoa, n, int); if(aoa == NULL) croak("Failed to allocate rows"); for(i = 0; i < n; ++i) { Newz(i, aoa[i], n, int); if(aoa[i] == NULL) croak("Failed to allocate columns"); } I've successfully placed (and accessed) data in the structure, so I guess I've done it correctly so far. To free the memory I've done: for(i = 0; i < n; ++i) Safefree(aoa[i]); But there's still some more memory to Safefree() isn't there ? I tried adding: Safefree(aoa); But that crashes the program. What do I need to do ? Also, as regards the first argument supplied to New() - is there any reason that it should be different (ie unique) for each 'New()' call within a program ? I'm working on Win2k, perl5.6.1, and writing code to be used with Inline C .... if any of that makes any difference. (I don't think it does :-) Cheers, Rob