memory-leaks

Example of memory leak in indexedDB at store.add (see Example at Edit)

a 夏天 提交于 2019-12-25 02:13:35
问题 I'm struggling to understand why this code generates a memory leak, or at least what appears to be a memory leak. I'm attempting to write a portfolio of quiz objects to an indexedDB database. At this stage, I'm just trying to test the speed of writing different numbers of quizzes of different sizes. Included is only the portion of the code that writes to the database. The port.quiz[] object is defined globally. The code is set up to display messages as each quiz is successfully written and a

Doctrine 2 bulk insert/update memory

若如初见. 提交于 2019-12-25 02:04:29
问题 Consider this code (wrapped inside a function): $manager = $this->manager; // local ref $q = $manager->createQuery('select c from VendorFeedBundle:Category c'); $iterableResult = $q->iterate(); $i = 0; $batchSize = 500; foreach($iterableResult as $row) { $category = $row[0]; $struct = explode(' ' . $this->separator . ' ', $category->getPath()); unset($struct[count($struct) - 1]); $path = implode(' ' . $this->separator . ' ', $struct); if (!$parent = $this->repo->findOneBy(['path' => $path]))

Potential leak of an object warning — clarification needed

不问归期 提交于 2019-12-25 01:55:48
问题 After I Analyzed my code, Xcode indicated a potential leak as shown below. Is this something I should be concerned about? In this code, the class that sets doublyLinkedList is the sole owner and continues to manage this object throughout program execution. 回答1: You may wish to do this instead: if (self) { DoublyLinkedList *dll = [DoublyLinkedList new]; self.doublyLinkedList = dll; [dll release]; } In the header, declare doublyLinkedList a @property that is retained. 回答2: The reason you're

Python C Wrapper Memory Leak

巧了我就是萌 提交于 2019-12-25 01:49:12
问题 I am moderately experienced in python and C but new to writing python modules as wrappers on C functions. For a project I needed one function named "score" to run much faster than I was able to get in python so I coded it in C and literally just want to be able to call it from python. It takes in a python list of integers and I want the C function to get an array of integers, the length of that array, and then return an integer back to python. Here is my current (working) solution. static

Handling memory leak in cyclic graphs using RefCell and Rc

人走茶凉 提交于 2019-12-25 01:45:56
问题 I followed the approach mentioned in https://ricardomartins.cc/2016/06/08/interior-mutability for creating a graph in Rust using Rc and RefCell . type NodeRef<i32> = Rc<RefCell<_Node<i32>>>; #[derive(Clone)] // The private representation of a node. struct _Node<i32> { inner_value: i32, adjacent: Vec<NodeRef<i32>>, } #[derive(Clone)] // The public representation of a node, with some syntactic sugar. struct Node<i32>(NodeRef<i32>); impl<i32> Node<i32> { // Creates a new node with no edges. fn

PHP: Memory leak in recursive function

a 夏天 提交于 2019-12-25 01:31:20
问题 I have a recursive function which, given an id, builds up a directory path. The thing is, it doesn't free up the space, so starting with a memory consumption of 15MB after 1761 folders, the memory consumption is at about 150MB which is not healthy. this is the function: private function buildDirectoryPath($iId, $sDir = "") { $oFolder = Folders::getFolder($iId); if (!empty($sDir)) $sDir = $oFolder->getName() . "/" . $sDir; else $sDir = $oFolder->getName(). $sDir; if ($oFolder->getParentId() >

_CrtMemDumpAllObjectsSince() function is not able to detect leaks if delete array called instead of delete []array

有些话、适合烂在心里 提交于 2019-12-25 00:42:39
问题 Here is some sample code: #include <crtdbg.h> #include <windows.h> #ifdef _DEBUG #define new DEBUG_CLIENTBLOCK #endif int main() { int* arr = new int[10]; delete arr; //not using delete [] arr _CrtMemDumpAllObjectsSince(NULL); // dumping leak logs return 0; } As you can see that I have not used delete [] arr and still I did not get any leaks. Can anyone please correct it and explain me why _CrtMemDumpAllObjectsSince() is not dumping leaks in above code. 回答1: The official answer is that

Memory leak with interface referance

会有一股神秘感。 提交于 2019-12-25 00:05:49
问题 I have a question about memory leak.I have two classes. The first one is: public class Utility { private static Utility instance = null; private UpdateListener listener; //Make it a Singleton class private Utility(){} public static Utility getInstance() { if (instance == null) instance = new Utility(); return instance; } public void setListener(UpdateListener listener) { this.listener = listener; } //Long running background thread public void startNewTread() { new Thread (new Runnable() {

Memory leak - why too many “Ichangetoken” objects

好久不见. 提交于 2019-12-24 22:23:53
问题 Above is the screenshot when compared to baseline of memory dump. I have an api method, which I'm calling every 3 seconds and nothing else is going on in the environment like, no user using the environment. When I debug in VS2017, for each request that I make, I it is calling some services like "addtransient","addscopped" etc. and in the startup file we are configuring different config files return builder.AddDataEngineFile(s => { s.FileProvider = provider; s.Path = path; s.Optional =

How to find native memory leaks caused by a java code?

Deadly 提交于 2019-12-24 21:32:44
问题 I have a java code which basically creates, displays and then destroys geometry objects like spheres for a certain number of iterations. I use native opengl calls for displaying these objects. There is some memory leak in the code as the native memory keeps on increasing. I am checking the native memory by viewing the "Workink Set" memory in Task manager. However, when I ran the netbeans profiler, I couldn't find any memory leak. So, how to find the native memory leak? Are there any tools