{"action":"created","issue":{"url":"https://api.github.com/repos/rdkit/rdkit/issues/747","labels_url":"https://api.github.com/repos/rdkit/rdkit/issues/747/labels{/name}","comments_url":"https://api.github.com/repos/rdkit/rdkit/issues/747/comments","events_url":"https://api.github.com/repos/rdkit/rdkit/issues/747/events","html_url":"https://github.com/rdkit/rdkit/issues/747","id":128256810,"number":747,"title":"Segfault in Chem.GetAdjacencyMatrix()","user":{"login":"rappoport","id":1903545,"avatar_url":"https://avatars.githubusercontent.com/u/1903545?v=3","gravatar_id":"","url":"https://api.github.com/users/rappoport","html_url":"https://github.com/rappoport","followers_url":"https://api.github.com/users/rappoport/followers","following_url":"https://api.github.com/users/rappoport/following{/other_user}","gists_url":"https://api.github.com/users/rappoport/gists{/gist_id}","starred_url":"https://api.github.com/users/rappoport/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rappoport/subscriptions","organizations_url":"https://api.github.com/users/rappoport/orgs","repos_url":"https://api.github.com/users/rappoport/repos","events_url":"https://api.github.com/users/rappoport/events{/privacy}","received_events_url":"https://api.github.com/users/rappoport/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-01-22T22:00:52Z","updated_at":"2016-01-29T05:18:06Z","closed_at":null,"body":"There seems to be a memory issue in Chem.GetAdjacencyMatrix(), which causes the following simple script to quit out with a segfault.\r\n\r\n\r\n\r\n    #!/usr/bin/env python\r\n    # test_rdkit.py\r\n\r\n    import openbabel\r\n    from rdkit import Chem\r\n\r\n    adj = Chem.GetAdjacencyMatrix(Chem.MolFromSmiles('CO'))\r\n    print adj\r\n\r\nIf openbabel is commented out, the segfault goes away, which I think points to a memory issue. Running valgrind against python with the above script shows (with default suppression file from http://svn.python.org/projects/python/trunk/Misc/valgrind-python.supp) \r\n\r\n    valgrind --tool=memcheck --suppressions=valgrind-python.supp python ./test_rdkit.py\r\n\r\ntwo errors related to Boost::Python ([valgrind output](https://github.com/rdkit/rdkit/files/101498/valgrind-output.txt.gz)).\r\n\r\nSystem: Linux ... 2.6.32-431.17.1.el6.x86_64 #1 SMP Wed May 7 23:32:49 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux\r\nPython:  Python 2.7.6 |Anaconda 1.9.2 (64-bit)| (default, Jan 17 2014, 10:13:17)\r\nRDKit 2015.09.2\r\nBoost::Python 1.54.0"},"comment":{"url":"https://api.github.com/repos/rdkit/rdkit/issues/comments/176579802","html_url":"https://github.com/rdkit/rdkit/issues/747#issuecomment-176579802","issue_url":"https://api.github.com/repos/rdkit/rdkit/issues/747","id":176579802,"user":{"login":"greglandrum","id":540511,"avatar_url":"https://avatars.githubusercontent.com/u/540511?v=3","gravatar_id":"","url":"https://api.github.com/users/greglandrum","html_url":"https://github.com/greglandrum","followers_url":"https://api.github.com/users/greglandrum/followers","following_url":"https://api.github.com/users/greglandrum/following{/other_user}","gists_url":"https://api.github.com/users/greglandrum/gists{/gist_id}","starred_url":"https://api.github.com/users/greglandrum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greglandrum/subscriptions","organizations_url":"https://api.github.com/users/greglandrum/orgs","repos_url":"https://api.github.com/users/greglandrum/repos","events_url":"https://api.github.com/users/greglandrum/events{/privacy}","received_events_url":"https://api.github.com/users/greglandrum/received_events","type":"User","site_admin":false},"created_at":"2016-01-29T05:18:06Z","updated_at":"2016-01-29T05:18:06Z","body":"And can you please try modifying your code to this:\r\n```python\r\nm = Chem.MolFromSmiles('CO')\r\nadj = Chem.GetAdjacencyMatrix(m)\r\nprint adj\r\n```\r\nand see if you still have the problem?"}}