memory-leaks

Unexpected memory leak in multithread program

可紊 提交于 2020-02-25 05:03:08
问题 I'm working on a program using a large number of threads, each thread allocating in heap a few megabytes of memory. When these threads end, a large part of the RAM is kept by the program. Here is an example of code, allocating and freeing 1 MB in 500 threads, which shows this problem: #include <future> #include <iostream> #include <vector> // filling a 1 MB array with 0 void task() { const size_t S = 1000000; int * tab = new int[S]; std::fill(tab, tab + S, 0); delete[] tab; } int main() { std

Memory usages high - Slow application response : Used memory value not decreasing + Free memory value not increasing

冷暖自知 提交于 2020-02-20 05:23:50
问题 When application is in use for few minutes then it slowly increases the Used memory value and decreases Free memory value. Application get very slow after few minutes. Why isn't it releasing the memory. System configuration : CPU : Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz (No. of processors : 4 / No. of cpu cores : 8) RAM : 30 GB OS : CentOS-7 Application configuration : java version "1.8.0_171" -- build 1.8.0_171-b11 apache-tomcat-7.0.55 Tomcat setting Free -h command Top command . .

Qt: does “new without delete” cause memory leaks with controls?

心不动则不痛 提交于 2020-02-11 04:39:30
问题 I was looking at Qt example here: and inside the constructor, they have: Window::Window() { editor = new QTextEdit(); // Memory leak? QPushButton *sendButton = new QPushButton(tr("&Send message")); // Memory leak? connect(sendButton, SIGNAL(clicked()), this, SLOT(sendMessage())); QHBoxLayout *buttonLayout = new QHBoxLayout(); // Memory leak? buttonLayout->addStretch(); buttonLayout->addWidget(sendButton); buttonLayout->addStretch(); QVBoxLayout *layout = new QVBoxLayout(this); // Memory leak?

Qt: does “new without delete” cause memory leaks with controls?

耗尽温柔 提交于 2020-02-11 04:38:26
问题 I was looking at Qt example here: and inside the constructor, they have: Window::Window() { editor = new QTextEdit(); // Memory leak? QPushButton *sendButton = new QPushButton(tr("&Send message")); // Memory leak? connect(sendButton, SIGNAL(clicked()), this, SLOT(sendMessage())); QHBoxLayout *buttonLayout = new QHBoxLayout(); // Memory leak? buttonLayout->addStretch(); buttonLayout->addWidget(sendButton); buttonLayout->addStretch(); QVBoxLayout *layout = new QVBoxLayout(this); // Memory leak?

Python Dictionary Size Maximum Limit

Deadly 提交于 2020-02-08 02:49:29
问题 I am trying to understand the reason for the following MemoryError. Is there some pre-defined limit on dictionaries in python? self.text is long string read in from a file (about 4.5 MB) L is equal to 4641652 L = len(self.text) test = {} for i in xrange(L,0,-1): try: test[i] = self.text[i-1:] except MemoryError: print "Memory Error at the " + str(i) +"th iteration!" print sys.getsizeof(test) print len(test) exit() Output Memory Error at the 4577890th iteration! 1573004 63762 I am running the

c# memory leak in loop

怎甘沉沦 提交于 2020-02-07 05:42:08
问题 public void DoPing(object state) { string host = state as string; m_lastPingResult = false; while (!m_pingThreadShouldStop.WaitOne(250)) { Ping p = new Ping(); try { PingReply reply = p.Send(host, 3000); if (reply.Status == IPStatus.Success) { m_lastPingResult = true; } else { m_lastPingResult = false; } } catch { } numping = numping + 1; } } Any idea why this code gives me a memory leak? I can see it's this code as changing the wait value to smaller or larger values increases the rate of the

JSON Builder cause memory leak in Tomcat8 Application

微笑、不失礼 提交于 2020-02-06 10:37:54
问题 I've created a WebApp for a Tomcat8 Server. It is a small webbased game. Since I've switched from flatfiles to MySQL I have a lot of problems with javax.json builder. Here the part of my code: public void saveUserResearch(){ MySQLTable t = SpaceWar.instance().getUserResearchTable(); JsonObjectBuilder mainBuilder = Json.createObjectBuilder(); JsonObjectBuilder subBuilder = Json.createObjectBuilder(); for(UserResearch r : getResearchList()){ int index = r.getIndex(); subBuilder = Json

JSON Builder cause memory leak in Tomcat8 Application

巧了我就是萌 提交于 2020-02-06 10:35:10
问题 I've created a WebApp for a Tomcat8 Server. It is a small webbased game. Since I've switched from flatfiles to MySQL I have a lot of problems with javax.json builder. Here the part of my code: public void saveUserResearch(){ MySQLTable t = SpaceWar.instance().getUserResearchTable(); JsonObjectBuilder mainBuilder = Json.createObjectBuilder(); JsonObjectBuilder subBuilder = Json.createObjectBuilder(); for(UserResearch r : getResearchList()){ int index = r.getIndex(); subBuilder = Json

Possible Memory Leak due to org.hibernate.internal.SessionFactoryImpl

喜你入骨 提交于 2020-02-03 05:23:05
问题 I have made and MVC webapp in Java, but when I run it, once a day, it turns down again due to a memory error. This error is this: Exception in thread "http-apr-12136-exec-42" java.lang.OutOfMemoryError: Java heap space java.sql.SQLException: java.lang.OutOfMemoryError: Java heap space I have the hprof with the stats of the crash, where specific how is the memory used. If I open the hprof with the Eclipse Memory Analizer, I have this results: In rar: https://mega.co.nz/#!Ht41xJDJ

Java String Memory Leak

Deadly 提交于 2020-02-03 04:46:32
问题 I am not java expert. My code is reading a file into a String . This code gets executed every 5 minutes. The size of file varies. Sometimes it is 100 sometimes it is 1000 lines. I am experience Out Of Memory, after some days. The question I have is, when my codes goes out of scope of the Reading file function , does Java garbage collect the String? I am pretty confused by reading on the internet. Some people says it does not get deleted and use StringBuffer . // Demonstrate FileReader. import