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

Nicolas Decoster at
Mon Mar 22 18:35:11 CET 2004


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:


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.



More information about the Python-list mailing list