memory-leaks

Java Substring memory leak

拜拜、爱过 提交于 2019-12-22 12:21:04
问题 Based on the discussion about getting substring of String Java String.split memory leak? , I have been analyzing two sample substring examples of usage. It is said that objects don't get garbage collected if the caller stores a substring of a field in the object. When I run the code I get and OutofMemory Exception, and see the incresing of char[] allocated size while monitoring it via VisualVM public class TestGC { private String largeString = new String(new byte[100000]); String getString()

Why valgrind report my memory as “definitely lost”?

柔情痞子 提交于 2019-12-22 11:46:07
问题 Consider this code: #include <stdlib.h> int* alloc() { return malloc(250 * sizeof(int)); } int main() { int i; int *vars[3]; for(i = 0; i < 3; ++i) { vars[i] = alloc(); } } Valgrind output: $ valgrind --leak-check=full ./lala ==16775== Memcheck, a memory error detector ==16775== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==16775== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info ==16775== Command: ./lala ==16775== ==16775== ==16775== HEAP SUMMARY: =

Long running application slows down

别来无恙 提交于 2019-12-22 11:44:10
问题 There is an application that consists of three executable files. One of them - a dispatcher, which runs other executables. The dispatcher receives a code from an executable at its completion. That is, only the dispatcher is always running, other executables unloads and loads again. The application runs on the point of service and work around the clock. At the first launch the application works fast. At the end of the day, the application works terribly slow. What could be the reason for such

C, Leak on fork without malloc

隐身守侯 提交于 2019-12-22 11:37:38
问题 I'm trying to understand how memory allocation work on fork, even on static or dynamic allocation. I've some trouble to understand some leaks as shown below. With this program : #include <unistd.h> #include <sys/wait.h> int main(int argc, char **argv) { pid_t pid; int status; pid = fork(); if (pid == 0) return (0); else { waitpid(pid, &status, 0); return (0); } } I'm getting this log file with valgrind : ==81268== Memcheck, a memory error detector ==81268== Copyright (C) 2002-2017, and GNU

How to reclaim the memory used by a Java thread stack?

 ̄綄美尐妖づ 提交于 2019-12-22 11:23:48
问题 I've been having this memory leak issue for days and I think I have some clues now. The memory of my java process keeps growing but yet the heap does not increase. I was told that this is possible if I create many threads, because Java threads uses memory outside of the heap. My java process is a server type program so there are 1000-2000 threads. Created and deleted ongoing. How do I reclaim the memory used by a java thread? Do I simply erase all references to the thread object and make sure

gStreamer Video Recording Memory Leak

此生再无相见时 提交于 2019-12-22 11:11:08
问题 HI I am trying to record rtsp stream coming from camera(H264 format). I am using following gst command to do recording in MPEG4 Format gst-launch -e rtspsrc location=rtsp://10.17.8.136/mediainput/h264 latency=100 ! decodebin ! ffenc_mpeg4 ! avimux ! filesink location=test.mp4 and H264 format gst-launch-0.10 -e rtspsrc location="rtsp://10.17.8.136/mediainput/h264" latency=100 ! rtph264depay byte-stream=false ! capsfilter caps="video/x-h264,width=1920,height=1080,framerate=(fraction)25/1" !

PHP memory leak and fork

依然范特西╮ 提交于 2019-12-22 11:09:12
问题 I'm trying to avoid the memory leak in PHP. When I create a object and unset it at the end it's still in memory. The unset looks like: $obj = NULL; unset($obj); Still this will not help. My question is what will happen when I fork the proccess and the object will be created and destructed in the child thread? Will this be the same? Or is there any other way how the free the memory? This is the import script which will consume few gigs of ram. 回答1: PHP 5.3 has a garbage collector that can

OpenCV MatToUIImage causes memory leak

谁都会走 提交于 2019-12-22 10:57:56
问题 My project is working with openCV for iOS(2.4.9). And I found function MatToUIImage which will cause memory leaks, and it only occurs on iOS 10.X. After I updated this function(2.4.9) to latest(3.2.0) version everything got worked. The only difference is CGBitmapInfo . So can anyone tell me why? 2.4.9 UIImage* MatToUIImage(const cv::Mat& image) { NSData *data = [NSData dataWithBytes:image.data length:image.elemSize()*image.total()]; CGColorSpaceRef colorSpace; if (image.elemSize() == 1) {

dompdf memory issues

别说谁变了你拦得住时间么 提交于 2019-12-22 10:46:21
问题 I'm using DOMPDF to generate about 500 reports from one script. It's running out of memory after about 10-15 PDFs have been generated. In debugging, it looks like it's loading 8M every time it gets to the font loading stuff, but this seems like something that should be handled with the font caching code. Any ideas of what's going wrong here? I'd like to post a simple code snippet, but most of it is abstracted into multiple layers, so it's not just a simple copy/paste. 回答1: First if this is

How to find memory leaks in my Java application

江枫思渺然 提交于 2019-12-22 10:27:43
问题 This is a follow-up question from my previous question HERE. I was witnessing memory leaks in my Java application. Initially, I was thinking that the leak is coming from the Server component of my application. But as per other's suggestion, it wasn't. I used a tool to dump the heap memory and visualize it with JProfiler . Apparently it is due to my suspected HashMaps . But I'm not sure as I'm not familiar how to interpret the dump. Here is a brief snippet of my application's structure (it is