opened
universewill
username_0
My code is something like this. The search function can do well in test() function, but it encounters core dumped error outside the test() fucntion.

My system is ubuntu 16.04, python3.6, with faiss-cpu installed using conda.
It seems to be weird.

```
def test():
    nlist=100
    nprobe =8
    codebook = np.random.random((1000, 128)).astype('float32')
    quantizer = faiss.IndexFlatL2(128)
    index_128 = faiss.IndexIVFFlat(quantizer, 128, 100, faiss.METRIC_L2)
    index_128.train(codebook)
    index_128.add(codebook)
    index_128.nprobe = nprobe
    print(index_128.search(codebook[101:102],k=20))
    return index_128

if __name__ == '__main__':

     index_128 =test()
     print('test la ...')
     codebook = np.random.random((1000, 128)).astype('float32')
     print(index_128.search(codebook[101:102],k=20))
```
weird behavior of faiss python api
issue
created
Enet4
username_1
This seems like the same issue described in the FAQ: [Crashes in pure Python code](https://github.com/facebookresearch/faiss/wiki/Troubleshooting#crashes-in-pure-python-code). Since the IVF flat index also comprises a quantizer, you need to either keep a reference to `quantizer` or instruct the index to own it.
comment