memory

Calling AFNetworking in NSTimer causes serious memory leak

一笑奈何 提交于 2020-01-06 15:11:31
问题 I'm trying to debug a difficult memory leak. In MyAppDelegate.m, I have - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.notificationTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(syncNotifications:) userInfo:nil repeats:YES]; return YES; } - (void)syncNotifications:(NSTimer*)timer { NSString *path = @"http://example"; NSLog(@"GET: %@", path); AFHTTPRequestOperationManager *network =

Get the pagefile size of a drive

扶醉桌前 提交于 2020-01-06 14:56:40
问题 How can I find the current pagefile size of a drive? Priror to windows 7, There used to be a script named pafefileconfig.vba in System32 folder which can be used. But its now removed. Is it possible to get the details using JNA? If yes, how? EDIT This is the code i wrote to get the pagefile info using JNA: Kernel32 kernel32 = (Kernel32)Native.loadLibrary("kernel32", Kernel32.class); MEMORYSTATUSEX memInfo = new MEMORYSTATUSEX(); kernel32.GlobalMemoryStatusEx(memInfo); int toMB = (1024*1024);

Get the pagefile size of a drive

痞子三分冷 提交于 2020-01-06 14:55:51
问题 How can I find the current pagefile size of a drive? Priror to windows 7, There used to be a script named pafefileconfig.vba in System32 folder which can be used. But its now removed. Is it possible to get the details using JNA? If yes, how? EDIT This is the code i wrote to get the pagefile info using JNA: Kernel32 kernel32 = (Kernel32)Native.loadLibrary("kernel32", Kernel32.class); MEMORYSTATUSEX memInfo = new MEMORYSTATUSEX(); kernel32.GlobalMemoryStatusEx(memInfo); int toMB = (1024*1024);

Node Async Looping - Why does the memory grow and just drop all of the sudden?

孤街醉人 提交于 2020-01-06 14:52:13
问题 I'm writing a program in Node that uses an async loop. The goal is to get this program to run on Heroku for an extended period of time. It grows in memory, as expected. But then once the memory usage hits about 57MiB, it drops back down to 22MiB (where it started). What causes the memory usage to drop out of nowhere like that? Here is my code, if it helps at all. database.read is just a simplification of http.request . var http = require("http"); var util = require('util'); var fnstraj =

Converting imageNamed to imageWithContentsOfFile:

本小妞迷上赌 提交于 2020-01-06 14:44:10
问题 My code for my images is -(IBAction)start:(id)sender { animation.animationImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"Paddle 1.png"], [UIImage imageNamed:@"Paddle 2.png"], [UIImage imageNamed:@"Paddle 3.png"], [UIImage imageNamed:@"Paddle 4.png"], nil]; [animation setAnimationRepeatCount:0]; animation.animationDuration = 2.5; [animation startAnimating]; } This is caching too much memory and I was told in a previous question to swap my code to using [UIImage

C# BigInteger and int How to save memory?

点点圈 提交于 2020-01-06 14:16:17
问题 I am testing a matrix if it has a prime number in every line. The MR means that it should use the Miller Rabin algorithm. If its false it simply tries the divisors up to sqrt(n). Vansor is true if it has found a prime in every checked row, vanoszlop is true if it has found a prime in the actually checked row. My question is: Is it possible to save the memory by not creating both the int and BigInteger values only if the tryParse is true? I mean something like if (int.tryParse(akt, out new int

Search a value in two dimension arrays

帅比萌擦擦* 提交于 2020-01-06 13:11:15
问题 I have many arrays like this: Array ( [1] => Array ( [Field] => column1 [Type] => varchar(50) [PrimaryKey] => PRI ) [2] => Array ( [Field] => column2 [Type] => varchar(50) [PrimaryKey] => ) [3] => Array ( [Field] => column3 [Type] => timestamp [PrimaryKey] => ) [4] => Array ( [Field] => column4 [Type] => varchar(50) [PrimaryKey] => ) [5] => Array ( [Field] => column5 [Type] => varchar(50) [PrimaryKey] => ) [6] => Array ( [Field] => column6 [Type] => varchar(50) [PrimaryKey] => ) [7] => Array

Memset with stride

北城以北 提交于 2020-01-06 13:11:07
问题 With OpenGL, there's a lot of times where putting strides on the data is necessary for better efficiency. for example, the memory structure would be vertex-color-normal-vertex-color-normal.. etc. Is there any viable option for changing, say, only the color section of a memory with some kind of memset variant (that is, not using a loop). Also brings to question, is there such thing as a looping memset? For example, in an array of colors made of four floats each, set all of them to a particular

Where/how to delete an object within another object, outside the function that it was created in

泪湿孤枕 提交于 2020-01-06 12:27:08
问题 In order to solve this problem Bad memory management? Class member (boolean) value greater than 1, in recursion function, I ran the whole program under Valgrind and found a few memory leak problems that occurred before the step. There were 2 'definitely lost' problems identified in the function CMFLoader. (here MyDataset is a vector of Molecule objects, and each Molecule object contains an Elements object) In CMFLoader::loadFile(vector& MyDataset), I originally have MyDataset.push_back(

When and why will an OS initialise memory to 0xCD, 0xDD, etc. on malloc/free/new/delete?

拜拜、爱过 提交于 2020-01-06 08:29:23
问题 I know that the OS will sometimes initialise memory with certain patterns such as 0xCD and 0xDD. What I want to know is when and why this happens. When Is this specific to the compiler used? Do malloc/new and free/delete work in the same way with regard to this? Is it platform specific? Will it occur on other operating systems, such as Linux or VxWorks? Why My understanding is this only occurs in Win32 debug configuration, and it is used to detect memory overruns and to help the compiler