When looking at the code that is used to read tables from memory, I noticed an inconsistency in the memory management:
The array buffer returned by table_get_column() is neither freed nor is it copied to the numpy array. This will result in either:
a memory leak, if the table_get_column() returns copied data
memory corruptions at some point (if still using the numpy array when MAD-X has decided to free the buffer)
UPDATE: Just realized that the second case should be no problem, since the array is copied over the Pipe immediately. Still, its worth mentioning, see 629ae41.
I'm no genious here, I just tried to hack it together until it worked.. So feel free to make it more safe! Maybe that is why some of the models are crashing...
When looking at the code that is used to read tables from memory, I noticed an inconsistency in the memory management:
The array buffer returned by
table_get_column()
is neither freed nor is it copied to the numpy array. This will result in either:table_get_column()
returns copied dataUPDATE: Just realized that the second case should be no problem, since the array is copied over the Pipe immediately. Still, its worth mentioning, see 629ae41.