memory-leaks

Memory Leaks in C Linked List

喜欢而已 提交于 2019-12-23 12:38:13
问题 I've been working on a project for school (Due tonight!), and I'm having some serious memory issues. I'm fairly new to C and am still being thrown for a loop when it comes to mallocing pointers and whatnot, so I could really use some help. The code is as follows. The order of the files is LinkedLists.h (Header for LinkedList module), LinkedLists.c (LinkedList module), and TestList.c (Main module). /****************************************************************************** * Base struct to

How can I debug a memory leak on my Apollo GraphQL server?

江枫思渺然 提交于 2019-12-23 10:49:21
问题 Answers to this question are eligible for a +200 reputation bounty. Bounty grace period has ended. Alexis Tyler is looking for an answer from a reputable source . I have a graphql server with multiple endpoints. It is basically just a CRUD app, so I'm honestly not sure why there's a memory leak. The only potentially leaky endpoint I have is one that uploads pics to S3. I've been looking around and have tried taking heap snapshots and comparing them but I'm not even sure which endpoint is the

On OSX Valgrind reports this memory leak, Where is it coming from?

女生的网名这么多〃 提交于 2019-12-23 10:08:52
问题 On OSX Valgrind reports this memory leak, Where is it coming from? The code is c compiled with g++ as c++ code (i do this for function overloading). ==13088== 18 bytes in 1 blocks are definitely lost in loss record 82 of 264 ==13088== at 0x1F25DC: malloc_zone_malloc (vg_replace_malloc.c:267) ==13088== by 0xA1AEDA: malloc_set_zone_name (in /usr/lib/system/libsystem_c.dylib) ==13088== by 0xA1B4A7: _malloc_initialize (in /usr/lib/system/libsystem_c.dylib) ==13088== by 0xA1B5DD: malloc_good_size

Work around SpellCheckerSession leak?

无人久伴 提交于 2019-12-23 09:32:31
问题 I discovered my Activity is leaking on the ICS emulator. HProf seemed to show SpellCheckerSession keeping a reference to my Activity around, and there appears to have been a fix: https://github.com/android/platform_frameworks_base/commit/df3722895172e03c81787f62d922daabaad3e20b But is there any way to work around this in the mean time? Can I disable spell checking somehow? 回答1: Does it need a Context ? Maybe pass the Application Context by using activity.getApplicationContext() . 回答2: I've

AdActivity leak on AdMob (SDK 7.0) for Android

馋奶兔 提交于 2019-12-23 09:27:35
问题 I have memory leaks regarding Interstitial ads of AdMob with AdActivity object. Whenever an ad is shown, AdActivity object count in the memory increments by 1. I inspect all changes via MAT after explicit GC calls. I use the latest versions of everything. At first, I thought that this is related to how I implemented my UI or project, but creating a fresh and empty project shows the same leak. This leak has also existed in the previous Admob SDK (Google Play Services) and now it exists in

Deleting large Javascript objects when process is running out of memory

拜拜、爱过 提交于 2019-12-23 08:55:08
问题 I'm a novice to this kind of javascript, so I'll give a brief explanation: I have a web scraper built in Nodejs that gathers (quite a bit of) data, processes it with Cheerio (basically jQuery for Node ) creates an object then uploads it to mongoDB. It works just fine, except for on larger sites. What's appears to be happening is: I give the scraper an online store's URL to scrape Node goes to that URL and retrieves anywhere from 5,000 - 40,000 product urls to scrape For each of these new URLs

How do i explicitly clear the byte[]

耗尽温柔 提交于 2019-12-23 08:54:30
问题 I am creating new byte arrays which are not being collected by GC and are living in memory and increasing the private bytes. The code below gets executed every 10 seconds. How do I explicitly clear the variable after I am done with it? byte[] outputMessage = new byte[10000]; //Do some work here 回答1: How do you know they are not being collected? The code you provide is fine, and it should become eligible for collection if you don't have any dangling references to it. Explicitly, you can clear

Thunk memory leak as a result of map function

陌路散爱 提交于 2019-12-23 08:49:45
问题 I am writing a multi-threaded program that makes quite a use of mvars; in this case I have a thread that periodically changes list inside an mvar. Unfortunately, there is a thunk memory leak. There seems to be aproblem that the 'map id' (in real program I use something else than id) function leaks. I just cannot find a way how to avoid that - I was playing with 'seq' with no result. What is the right way to fix the leak? upgraderThread :: MVar [ChannelInfo] -> IO () upgraderThread chanMVar =

Should memory usage increase when using ElementTree.iterparse() when clear()ing trees?

倖福魔咒の 提交于 2019-12-23 08:46:28
问题 import os import xml.etree.ElementTree as et for ev, el in et.iterparse(os.sys.stdin): el.clear() Running the above on the ODP structure RDF dump results in always increasing memory. Why is that? I understand ElementTree still builds a parse tree, albeit with the child nodes clear() ed. If that is the cause of this memory usage pattern, is there a way around it? 回答1: You are clear ing each element but references to them remain in the root document. So the individual elements still cannot be

How do I fix this Android memory leak involving Threads?

孤街醉人 提交于 2019-12-23 08:29:34
问题 So I've found, with the MAT that I keep creating multiple Threads with every surfaceCreate I think I need these threads, though, but this method causes multiple instances of ViewThread , as a user navigates through my app, which is a memory leak. How can I reorganize the way my threads are created and handled so that this doesn't happen, or how can I stop the leak from occurring? @Override public void surfaceCreated(SurfaceHolder holder) { loading=false; if (!mThread.isAlive()){ mThread = new