PyBuffer. Question on memory shared by C app and python.

Nicolas Decoster my.name at my.org.fr
Mon Mar 22 18:35:11 CET 2004


Hi.

I have an app that allocates memory. I have created a python buffer that 
shares this memory. Example:

data = (double*) malloc(size*sizeof(double));
buffer = PyBuffer_FromReadWriteMemory(data, size*sizeof(double));

The app and python interpreter does lots of things they find usefull.

And one day, the app decides to free the memory:

free(data);

How can the app tell python not to try to access memory no more?

Am I sure at this point that the app is the only one that has a ref on 
my Object?

Thanks in advance for any suggestions.

Nicolas.

--
Noveltis




More information about the Python-list mailing list