After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 691606 - MemoryLeak when creating Gio::FileInputStream
MemoryLeak when creating Gio::FileInputStream
Status: RESOLVED FIXED
Product: glibmm
Classification: Bindings
Component: giomm
2.4.x
Other Linux
: Normal major
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2013-01-12 14:34 UTC by gnome-bugzilla.Dodak4Gi
Modified: 2013-01-14 18:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
All fiels needed to reproduce this bug (10.00 KB, application/x-gzip)
2013-01-12 14:34 UTC, gnome-bugzilla.Dodak4Gi
Details

Description gnome-bugzilla.Dodak4Gi 2013-01-12 14:34:28 UTC
Created attachment 233302 [details]
All fiels needed to reproduce this bug

I've found a memory Leak in Giomm 2.4 64-Bit.

The glibmm-version is the version one can install from Synaptics in Linux Mint 14.


Minimum Example:


#include <gtkmm.h>
#include <iostream>

int main(int argc, char** argv)
{
  Gtk::Main main(argc, argv);

  try
  {
    Glib::RefPtr<Gio::File> file = Gio::File::create_for_path("/path/to/existing/file");

    while(1)
    {

      Glib::RefPtr<Gio::FileInputStream> stream = file->read();
      stream->close();
      stream.clear();
    }
  }catch(const Glib::Exception& e)
  {
    std::cout<<"Exception:\n"<<e.what()<<"\n";
    return 23;
  }

  return 0;
}


"/path/to/existing/file" must be a path to an existing file ;)
Just run this sample and watch in your System Monitor/Taskmanager the usage of memory raise.




I have attached all files needed to reproduce this bug:

repro.cpp    the minimum example (exactly the same code as above)
compile.sh   a shellscript compiling the code
Comment 1 Kjell Ahlstedt 2013-01-14 15:55:35 UTC
File glibmm/gio/src/file.hg contains too many 'refreturn'.
Gio::File::read() is one of many methods that has a refreturn in its
_WRAP_METHOD although the description of the corresponding glib function says
  "Free the returned object with g_object_unref()."
I'll fix that.
Comment 2 Kjell Ahlstedt 2013-01-14 18:54:54 UTC
Fixed in the master branch with this commit:
http://git.gnome.org/browse/glibmm/commit/?id=16269fd1c0c53f77e1365c5cc8a2ea9ddefe9fa0

and in the glibmm-2-34 branch with this commit:
http://git.gnome.org/browse/glibmm/commit/?h=glibmm-2-34&id=855c956205afd31a2b141c22fa2986580991c41e