As to how you would take a char string to "perl land" and back, and then free the memory is probably beyond me ....
Then again, the following code does take a char string to "perl land" and back, with no errors and no memory leak afaict.
------------------------------------------------------
use warnings;
use Inline C => <<'EOC';
char * create_str(int len) {
char * temp;
int i; New(123, temp, len, char);
if (temp == NULL) croak("Failed to allocate memory"); for(i = 0; i < len - 1; ++i) temp[i] = 'a';
temp[len - 1] = '\0'; return temp;
}void release(char * in) {
Safefree(in);
}EOC
for(1..100) {
$x = create_str(200000);
release($x);
sleep(1);
}
------------------------------------------------------Once again I see a memory leak if I remove the the release() call from the perl code - though, once again, memory usage does not increase at *every* iteration.
Makes me think that the OP's original problem might just have been that he wrote 'Safefree((void*) image);' instead of 'Safefree(image);'.
Or is there something bodgy wrt my testing procedure ?
Sorry David - I probably should have taken the time to test some of this before I posted - (or maybe just not have posted at all :-)
Cheers, Rob
--
Any emails containing attachments will be deleted from my ISP's mail server before I even get to see them. If you wish to email me an attachment, please provide advance warning so that I can make the necessary arrangements.
