{"action":"created","issue":{"url":"https://api.github.com/repos/Unidata/netcdf-fortran/issues/34","labels_url":"https://api.github.com/repos/Unidata/netcdf-fortran/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/Unidata/netcdf-fortran/issues/34/comments","events_url":"https://api.github.com/repos/Unidata/netcdf-fortran/issues/34/events","html_url":"https://github.com/Unidata/netcdf-fortran/issues/34","id":117634666,"number":34,"title":"Memory Leak","user":{"login":"WardF","id":4324946,"avatar_url":"https://avatars.githubusercontent.com/u/4324946?v=3","gravatar_id":"","url":"https://api.github.com/users/WardF","html_url":"https://github.com/WardF","followers_url":"https://api.github.com/users/WardF/followers","following_url":"https://api.github.com/users/WardF/following{/other_user}","gists_url":"https://api.github.com/users/WardF/gists{/gist_id}","starred_url":"https://api.github.com/users/WardF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WardF/subscriptions","organizations_url":"https://api.github.com/users/WardF/orgs","repos_url":"https://api.github.com/users/WardF/repos","events_url":"https://api.github.com/users/WardF/events{/privacy}","received_events_url":"https://api.github.com/users/WardF/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Unidata/netcdf-fortran/labels/type/bug","name":"type/bug","color":"F7C6C7"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/Unidata/netcdf-fortran/milestones/5","html_url":"https://github.com/Unidata/netcdf-fortran/milestones/4.4.3","labels_url":"https://api.github.com/repos/Unidata/netcdf-fortran/milestones/5/labels","id":1418360,"number":5,"title":"4.4.3","description":null,"creator":{"login":"WardF","id":4324946,"avatar_url":"https://avatars.githubusercontent.com/u/4324946?v=3","gravatar_id":"","url":"https://api.github.com/users/WardF","html_url":"https://github.com/WardF","followers_url":"https://api.github.com/users/WardF/followers","following_url":"https://api.github.com/users/WardF/following{/other_user}","gists_url":"https://api.github.com/users/WardF/gists{/gist_id}","starred_url":"https://api.github.com/users/WardF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WardF/subscriptions","organizations_url":"https://api.github.com/users/WardF/orgs","repos_url":"https://api.github.com/users/WardF/repos","events_url":"https://api.github.com/users/WardF/events{/privacy}","received_events_url":"https://api.github.com/users/WardF/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2015-11-18T17:13:37Z","updated_at":"2015-11-18T17:13:43Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-11-18T17:13:43Z","updated_at":"2015-11-18T17:13:54Z","closed_at":null,"body":"This issue was reported by Joost aan de Brugh via Unidata esupport.  The relevant information from the initial emails are here:\r\n\r\nWe encountered a memory leak in a NetCDF interface for Fortran 90. The\r\nmemory leak occurs when a there is an attribute that is a compound that\r\ncontains a string. The memory is leaked when just opening and closing\r\nthe file with nf90_open and nf90_close. Below, I will give an NCDUMP\r\noutput of a small leaking NetCDF file.\r\n\r\nWe already contacted the HDF5 support and the memory leak does not occur\r\nwhen reading the same file with just the HDF5 interface.\r\n\r\nFor development, however, we prefer the nf90-interface above the\r\nh5-interface. Is there a possibility to get rid of the memory leak with\r\nthe nf90-interface?\r\n\r\n````\r\nNCDUMP output of a leaking NetCDF file:\r\nnetcdf memory_leak {\r\ntypes:\r\ncompound cmp {\r\nstring content1 ;\r\nstring content2 ;\r\n}; // cmp\r\nvariables:\r\nfloat var ;\r\ncmp var:att = {\"example\", \"X\"} ;\r\ndata:\r\n\r\nvar = 5.2 ;\r\n}\r\n````\r\nWhen opening and closing the file, 10 bytes of memory are leaked, equal\r\nto the sum of the string lengths (including termination characters).\r\n"},"comment":{"url":"https://api.github.com/repos/Unidata/netcdf-fortran/issues/comments/157782993","html_url":"https://github.com/Unidata/netcdf-fortran/issues/34#issuecomment-157782993","issue_url":"https://api.github.com/repos/Unidata/netcdf-fortran/issues/34","id":157782993,"user":{"login":"WardF","id":4324946,"avatar_url":"https://avatars.githubusercontent.com/u/4324946?v=3","gravatar_id":"","url":"https://api.github.com/users/WardF","html_url":"https://github.com/WardF","followers_url":"https://api.github.com/users/WardF/followers","following_url":"https://api.github.com/users/WardF/following{/other_user}","gists_url":"https://api.github.com/users/WardF/gists{/gist_id}","starred_url":"https://api.github.com/users/WardF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WardF/subscriptions","organizations_url":"https://api.github.com/users/WardF/orgs","repos_url":"https://api.github.com/users/WardF/repos","events_url":"https://api.github.com/users/WardF/events{/privacy}","received_events_url":"https://api.github.com/users/WardF/received_events","type":"User","site_admin":false},"created_at":"2015-11-18T17:13:54Z","updated_at":"2015-11-18T17:13:54Z","body":"I looked up the versions from our support website. It says\r\n\"netcdf-4 (4.3.3.1)\"\r\n\"netcdf-fortran (4.4.2)\"\r\n\"netcdf-cxx4 (4.2.1)\"\r\n\r\nI think that the first one is het underlying C library and that the middle one is our Fortran library and the latter one is irrelevant for me. Furthermoe, we use gfortan 4.9.2 and we use the underlying HDF5 libraries, version 1.8.15.\r\n\r\nWhen compiling our Fortran code, we use the following links:\r\n-lnetcdff -lnetcdf -lhdf5_fortran -hdf5_hl -hdf5 -lz\r\n"}}