memory-leaks

Does an Application memory leak cause an Operating System memory leak?

对着背影说爱祢 提交于 2020-01-12 04:07:15
问题 When we say a program leaks memory, say a new without a delete in c++, does it really leak ? I mean, when the program ends, is that memory still allocated to some non-running program and can't be used, or does the OS know what memory was requested by each program, and release it when the program ends? If I run that program a lot of times, will I run out of memory? 回答1: On operating systems with protected memory (Mac OS 10+, all Unix-clones such as Linux, and NT-based Windows systems meaning

How to avoid stack space overflows?

僤鯓⒐⒋嵵緔 提交于 2020-01-12 03:58:17
问题 I've been a bit surprised by GHC throwing stack overflows if I'd need to get value of large list containing memory intensive elements. I did expected GHC has TCO so I'll never meet such situations. To most simplify the case look at the following straightforward implementations of functions returning Fibonacci numbers (taken from HaskellWiki). The goal is to display millionth number. import Data.List # elegant recursive definition fibs = 0 : 1 : zipWith (+) fibs (tail fibs) # a bit tricky

Why ARC is not deallocating memory after popViewController

本秂侑毒 提交于 2020-01-11 17:12:40
问题 I'm pushing and popping ViewControllers in UINavigationController. I'm tracking the memory consumption of my app. While pushing the new viewController the memory consumption is increasing gradually, but when I'm popping the same ViewController using [self.navigationController popViewControllerAnimated:NO]; the memory consumption does not decrease but the constant. That particular viewController can be pushed and popped by user many times which can lead the high memory consumption of app in

increasing memory usage with jquery

你说的曾经没有我的故事 提交于 2020-01-11 13:14:20
问题 I am developing a site which heavily uses jquery (UI) for providing a good user experience. For some (stupid) reason parts of this site are shown within an iframe and there also is a button for refreshing the iframe to get the latest data from the server. The problem is that each time when refreshing the iframe the memory usage increases leading to serious memory problems after some time (Tested in IE8 & 9). But this occurs only if the jquery library is loaded. This behaviour can be seen best

Memory consumption after new then delete

落花浮王杯 提交于 2020-01-11 09:19:13
问题 I have created a sample application like below. I have a requirement to create 1024*1024 structs. Before calling the new operator my application is consuming some amount of memory (say 0.3mb). After calling the new operator the memory is increased (say 175mb). After calling the delete operator the memory is decreased (say 15mb). So finally there is a difference in the memory. I observed all these memory details from Task Manager. I am confused whether it should be considered as a memory leak,

Will using goto cause memory leaks?

本秂侑毒 提交于 2020-01-11 08:08:09
问题 I have a program in which i need to break out of a large bunch of nested for loops. So far, the way most people have been telling me to do it is to use an ugly goto in my code. Now, if i create a bunch of local stack (i think that's what they are called, if not, i mean just regular variables without using the new command) variables inside my loops and my program hits that one if statement that triggers the goto, will i encounter a memory leak due to my program exiting many loops improperly

Memory leak: steady increase in memory usage with simple device motion logging

不问归期 提交于 2020-01-11 06:52:25
问题 Consider this simple Swift code that logs device motion data to a CSV file on disk. let motionManager = CMMotionManager() var handle: NSFileHandle? = nil override func viewDidLoad() { super.viewDidLoad() let documents = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as NSString let file = documents.stringByAppendingPathComponent("/data.csv") NSFileManager.defaultManager().createFileAtPath(file, contents: nil, attributes: nil) handle = NSFileHandle

Out of memory exception while loading images

雨燕双飞 提交于 2020-01-11 06:29:09
问题 I am using the following piece of code to load images as thumbnails to a FlowLayoutPanel control. Unfortunately i get an OutOfMemory exception. As you already guess the memory leak is found at line Pedit.Image = System.Drawing.Image.FromStream(fs) So how could i optimize the following code? Private Sub LoadImagesCommon(ByVal FlowPanel As FlowLayoutPanel, ByVal fi As FileInfo) Pedit = New DevExpress.XtraEditors.PictureEdit Pedit.Width = txtIconsWidth.EditValue Pedit.Height = Pedit.Width / (4 /

Google Play Services Leak

♀尐吖头ヾ 提交于 2020-01-10 22:02:09
问题 I started using Google Play Game Services a while ago, and yesterday while checking the logcat I couldnt help to notice this error: E/DataBuffer(3183): Internal data leak within a DataBuffer object detected! Be sure to explicitly call close() on all DataBuffer extending objects when you are done with them. (internal object: com.google.android.gms.common.data.DataHolder@40555410) It occurs several times in a row. Im not exactly sure why it arises. It doesnt make my app crash nor makes the

Python: memory usage statistics per object-types (or source code line)

僤鯓⒐⒋嵵緔 提交于 2020-01-10 10:09:44
问题 I am doing some heavy calculations with Python (using OpenCV and Numpy) and in the end, I end up with a lot of memory usage (>1GB) whereby all refs should be gone and I only have the end-result (which should not be more than a few MB). To debug this, it would be nice if I could get some stats somehow which show me how much object instances there are of what type, ordered by the total amount of memory they take (per object class). Or even nicer: Not per object class but per source code line