qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [Bug 1836558] [NEW] Qemu-ppc Memory leak creating threads
@ 2019-07-15 10:18 Daan Scherft
  2019-07-15 13:34 ` [Qemu-devel] [Bug 1836558] " Daan Scherft
                   ` (9 more replies)
  0 siblings, 10 replies; 23+ messages in thread
From: Daan Scherft @ 2019-07-15 10:18 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

When creating c++ threads (with c++ std::thread), the resulting binary
has memory leaks when running with qemu-ppc.

Eg the following c++ program, when compiled with gcc, consumes more and
more memory while running at qemu-ppc. (does not have memory leaks when
compiling for Intel, when running same binary on real powerpc CPU
hardware also no memory leaks).

(Note I used function getCurrentRSS to show available memory, see
https://stackoverflow.com/questions/669438/how-to-get-memory-usage-at-
runtime-using-c; calls commented out here)

Compiler: powerpc-linux-gnu-g++ (Debian 8.3.0-2) 8.3.0 (but same problem with older g++ compilers even 4.9)
Os: Debian 10.0 ( Buster) (but same problem seen on Debian 9/stetch)
qemu: qemu-ppc version 3.1.50


---

#include <iostream>
#include <thread>
#include <chrono>


using namespace std::chrono_literals;

// Create/run and join a 100 threads.
void Fun100()
{
//    auto b4 = getCurrentRSS();
//    std::cout << getCurrentRSS() << std::endl;
    for(int n = 0; n < 100; n++)
    {
        std::thread t([]
        {
            std::this_thread::sleep_for( 10ms );
        });
//        std::cout << n << ' ' << getCurrentRSS() << std::endl;
        t.join();
    }
    std::this_thread::sleep_for( 500ms ); // to give OS some time to wipe memory...
//    auto after = getCurrentRSS();
    std::cout << b4 << ' ' << after << std::endl;
}


int main(int, char **)
{
    Fun100();
    Fun100();  // memory used keeps increasing
}

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1836558

Title:
  Qemu-ppc Memory leak creating threads

Status in QEMU:
  New

Bug description:
  When creating c++ threads (with c++ std::thread), the resulting binary
  has memory leaks when running with qemu-ppc.

  Eg the following c++ program, when compiled with gcc, consumes more
  and more memory while running at qemu-ppc. (does not have memory leaks
  when compiling for Intel, when running same binary on real powerpc CPU
  hardware also no memory leaks).

  (Note I used function getCurrentRSS to show available memory, see
  https://stackoverflow.com/questions/669438/how-to-get-memory-usage-at-
  runtime-using-c; calls commented out here)

  Compiler: powerpc-linux-gnu-g++ (Debian 8.3.0-2) 8.3.0 (but same problem with older g++ compilers even 4.9)
  Os: Debian 10.0 ( Buster) (but same problem seen on Debian 9/stetch)
  qemu: qemu-ppc version 3.1.50


  ---

  #include <iostream>
  #include <thread>
  #include <chrono>

  
  using namespace std::chrono_literals;

  // Create/run and join a 100 threads.
  void Fun100()
  {
  //    auto b4 = getCurrentRSS();
  //    std::cout << getCurrentRSS() << std::endl;
      for(int n = 0; n < 100; n++)
      {
          std::thread t([]
          {
              std::this_thread::sleep_for( 10ms );
          });
  //        std::cout << n << ' ' << getCurrentRSS() << std::endl;
          t.join();
      }
      std::this_thread::sleep_for( 500ms ); // to give OS some time to wipe memory...
  //    auto after = getCurrentRSS();
      std::cout << b4 << ' ' << after << std::endl;
  }

  
  int main(int, char **)
  {
      Fun100();
      Fun100();  // memory used keeps increasing
  }

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1836558/+subscriptions


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-03-10  8:58 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-15 10:18 [Qemu-devel] [Bug 1836558] [NEW] Qemu-ppc Memory leak creating threads Daan Scherft
2019-07-15 13:34 ` [Qemu-devel] [Bug 1836558] " Daan Scherft
2019-07-15 14:15 ` Alex Bennée
2019-07-15 15:10 ` Daan Scherft
2019-07-15 15:52 ` Alex Bennée
2019-07-15 16:21 ` Alex Bennée
2019-07-15 16:50 ` Alex Bennée
2019-07-16 12:13 ` [Qemu-devel] [RFC PATCH for 4.1?] target/ppc: move opcode decode tables to PowerPCCPU Alex Bennée
2019-07-16 12:13   ` [Qemu-devel] [Bug 1836558] " Alex Bennée
2019-07-16 14:50   ` [Qemu-devel] " Richard Henderson
2019-07-17  1:33   ` David Gibson
2019-07-17  9:41     ` Alex Bennée
2019-07-17  9:41       ` [Qemu-devel] [Bug 1836558] " Alex Bennée
2019-07-17 12:13   ` [Qemu-devel] " no-reply
2019-07-16 14:01 ` [Qemu-devel] [RFC PATCH for 4.1] linux-user: unparent CPU object before unref Alex Bennée
2019-07-16 14:01   ` [Qemu-devel] [Bug 1836558] " Alex Bennée
2019-07-16 14:43   ` [Qemu-devel] " Peter Maydell
2019-07-16 14:43     ` [Qemu-devel] [Bug 1836558] " Peter Maydell
2019-07-16 15:02     ` [Qemu-devel] " Alex Bennée
2019-07-16 15:02       ` [Qemu-devel] [Bug 1836558] " Alex Bennée
2019-07-16 15:17   ` [Qemu-devel] " Philippe Mathieu-Daudé
2020-01-09 13:22 ` [Bug 1836558] Re: Qemu-ppc Memory leak creating threads Thomas Huth
2020-03-10  8:48 ` Laurent Vivier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).