memory-management

Android Out of Memory Error - Bitmap is too big

纵饮孤独 提交于 2019-12-25 09:28:22
问题 In my game, I have a bitmap image which functions as the games background (drawn on a canvas). The bigger the image the more "space" there is in the game for the user to move in, so I want the bitmap to be as big as possible without causing memory problems. Well I went overboard and drew an enormous bitmap, which caused an out of memory error immediately on initialzation, so I shrunk the bitmap a bit. But I think its too small. My question is how can I measure the "safe" limit of the memory

Memory Management, ARC - what to nil?

若如初见. 提交于 2019-12-25 08:47:55
问题 Background - I am using automatic reference counting on a project. The root view is a Table View (Master / Detail setup) showing a list of "slide shows". Click on a table cell and you are taken to the detail view which consists of a Scroll view with views (viewController.view) in it (this is the "slide show"). Each slide show has a front cover and back cover (same view controller formatted differently) that sandwich an variable number of pages. Here is the code to load the slide show: - (void

Memory Management in Objective-C

主宰稳场 提交于 2019-12-25 08:21:15
问题 I wanna ask if I allocated an instance variable for private use in that class, should i release it immediately on site, or i can depend on dealloc function. (because maybe i will need it on other function) ? //Player.h @interface Player : NSObject { NSMutableArray * objectArray; } - (void)awake; - (void)add; @end //Player.m @implementation Player : NSObject { -(id) init { self = [super init]; if (self != nil ){ [self awake]; [self add]; } return self; } - (void) awake { objectArray = [

How Does JVM Uses Native Stack Manually For JAVA Function Call

依然范特西╮ 提交于 2019-12-25 08:04:53
问题 This is with reference to the answer in this post: How JVM stack, heap and threads are mapped to physical memory or operation system it says "JVM stack is the same a native stack" if that is the case then how jvm allocates stack frames on this stack memory whenever there is a function call in Bytecode and not the JVM code function call. If there is a function call in JVM code then the method local variables and other method related stuff will be stored in this native stack by OS. But if there

Concat two strings in C and allocate dynamically buffer

大城市里の小女人 提交于 2019-12-25 07:30:58
问题 I know this kind of question has already been asked. I also used the solution of this topic to my tests. However, I want to know how using this kind of function without memory leak neither exception. Note: LPTSTR ~ char* and LPCTSTR ~ const char* void add_to_buffer(LPTSTR* buffer, LPCTSTR msg) { // Determine new size int newSize = 0; // Allocate new buffer if (*buffer == NULL) newSize = _tcsclen(msg) + 1; // strlen() else newSize = _tcslen(*buffer) + _tcsclen(msg) + 1; LPTSTR newBuffer =

Memory error in pandas

浪子不回头ぞ 提交于 2019-12-25 07:14:04
问题 I have a csv file which has a size of around 800MB which I'm trying to load into a dataframe via pandas but I keep getting a memory error. I need to load it so I can join it to another smaller dataframe. Why am I getting a memory error even though I'm using 64bit versions of Windows, and Python 3.4 64bit and have over 8GB of RAM and plenty of harddisk? Is this is a bug in Pandas? How can I solve this memory issue? 回答1: reading your CSV in chunks might help: chunk_size = 10**5 df = pd.concat(

On VTable pointers and malloc

半腔热情 提交于 2019-12-25 06:52:24
问题 Is there any compiler independent and syntactically elegant way to set a vtable pointer in an object allocated with malloc? I cannot use new directly as I need to be able to control the flow of memory releases on demand which requires the use of void ptrs to hold memory locations in a memory manager until there is ample time to release. class AbstractData { public: AbstractData() {} virtual ~AbstractData() {} protected: virtual void SetData(int NewData) =0; virtual int GetData() const =0; };

Automated sparse matricies in Fortran

♀尐吖头ヾ 提交于 2019-12-25 05:32:14
问题 I know that Intel Fortran has libraries with functions and subroutines for working with sparse matricies, but I'm wondering if there is also some sort of data type or automated method for creating the sparse matricies in the first place. BACKGROUND: I have a program that uses some 3 & 4 dimensional arrays that can be very large in the first 2 dimensions (~10k to ~100k elements in each dimension, maybe more). In the first 2 dimensions, each array is mostly (95% or so) populated w/ zeroes. To

C++ return by value - what happens with the pointer inside?

不羁岁月 提交于 2019-12-25 05:32:10
问题 So I'm having a bit of SegFaults and was wondering if someone can explain me in higher depth how does this work. I have a wrapper class around a numeric variable, and I'm trying to build a compute tree of the expression. Here is a sample code: class DoubleWrap{ public: static int id; DoubleWrap(double value){this->value = value;myid=++id;} double value; int myid; std::vector<DoubleWrap*> parents; DoubleWrap operator+(DoubleWrap& x){ DoubleWrap result(this->value + x.value); setParents(*this

How much memory can x64 process can take on 4GB RAM

时光毁灭记忆、已成空白 提交于 2019-12-25 05:07:43
问题 I have a x64 application. It is a bit heavy application (in terms of thread counts, memory needed etc). I'm running this application on a 4GB RAM 64-bit Windows7 Quad core machine. But what i notice is after my application takes around 2.2-2.3 GB Ram it crashes. Is this required behavious? Can 64bit applications at max take only 2.3-2.4 GB RAM from 4GB RAM? 回答1: No, check that you don't have any overflows or other bugs first. Even 32-bit applications can address - use more RAM, so it would be