memory-management

Optimizing GridLayout's memory usage

落花浮王杯 提交于 2020-01-15 17:34:39
问题 I'm simulating a tile-based map in Android using android-support-v7-gridlayout. I implement it smoothly and fast during the debugging times until I test it on a huge data scale. The actual data would be about ~700x400 ( row-column ) and I just tested it in 400x100 but the application has just crashed and throws an OutOfMemoryException . I then reduced the data until it actually runs on 300x100 . It's not lagging or I don't have any CPU performance issue, the only issue is inadequate memory.

Optimizing GridLayout's memory usage

試著忘記壹切 提交于 2020-01-15 17:32:00
问题 I'm simulating a tile-based map in Android using android-support-v7-gridlayout. I implement it smoothly and fast during the debugging times until I test it on a huge data scale. The actual data would be about ~700x400 ( row-column ) and I just tested it in 400x100 but the application has just crashed and throws an OutOfMemoryException . I then reduced the data until it actually runs on 300x100 . It's not lagging or I don't have any CPU performance issue, the only issue is inadequate memory.

Memory allocation in header files

 ̄綄美尐妖づ 提交于 2020-01-15 11:55:06
问题 The company I'm working for have development rules for C development on embedded target. One is : It is recommended to not allocate any storage space in the header files. I'm not sure what it means, the person who wrote it is not around and the other developers don't really care, so I am asking here. What I understand is that I shouldn't declare variables in a header files, so something like that would be discouraged in a .h : int myVar; static char myOtherVar; What I don't understand is what

Getting data from pointer in struct “Invalid read/write”

偶尔善良 提交于 2020-01-15 10:03:56
问题 I am trying to do a implementation of circular buffer in array. I keep my data in structure and manage it by few methods as push, pop, etc. The program is more or less functional and behave as expected, however I run into errors in my valgrind test. And I am not capable of finding out what is wrong with my code. Although it seems like managing data via pointers in my struct is the crucial problem. I would be very grateful if anyone could point me in the right direction coz I am really lost at

Where are constant NSStrings allocated?

佐手、 提交于 2020-01-15 09:34:36
问题 I understand that constant CStrings are allocated statically, rather than on the heap. I also noticed that constant NSStrings have an infinite retain count. Does it hold true that constant NSStrings are also allocated statically, rather than on the heap? 回答1: Constant NSStrings are of class NSConstantString , and thus act like atoms in lisp; they hang around. -> NSConstantStrings are allocated statically. That is, if you use @"cow" in two separate places in your code, they will be referencing

MongoDB using much memory

余生颓废 提交于 2020-01-15 08:14:03
问题 Im tryin to migrate a mysql table to mongodb. My table has 6 million entries. Im using java with morphia. When i save about 1,2 million my memory is almost all consumed. I've read that mongo store the data in memory and after save in disk. Is it possible to send something like a commit to free some amount of memory? 回答1: 1) In terms of durability, you can tell the MongoDB java driver (which Morphia is using), which strategy to use, see https://github.com/mongodb/mongo-java-driver/blob/master

MongoDB using much memory

若如初见. 提交于 2020-01-15 08:13:52
问题 Im tryin to migrate a mysql table to mongodb. My table has 6 million entries. Im using java with morphia. When i save about 1,2 million my memory is almost all consumed. I've read that mongo store the data in memory and after save in disk. Is it possible to send something like a commit to free some amount of memory? 回答1: 1) In terms of durability, you can tell the MongoDB java driver (which Morphia is using), which strategy to use, see https://github.com/mongodb/mongo-java-driver/blob/master

NSMutableArray Access Issue

浪子不回头ぞ 提交于 2020-01-15 07:20:28
问题 I (think I) know what you're thinking... not another EXC_BAD_ACCESS question but I'm really struggling and it's driving me crazy. I've searched high and low all over the net and on here and the issue I'm facing seems have something to do with my memory management. Problem: Basically I have an NSMutableArray that keeps track of some cyber food. Since food can be added and taken away at the same time I have a separate array that checks for items to remove and holds the ones that don't need to

Is it possible to discover the typed array allocation limit in the browser?

半世苍凉 提交于 2020-01-15 06:59:29
问题 Experimenting with memory pool pre-allocation, I found that allocating a 60M Float32Array makes sometimes crash the browser tab (tried in Chrome): var bigArray = new Float32Array(60000000) for (var i = 0; i < bigArray.length; i+=1) { bigArray[i] = Math.random() } I'm allocating 240MB in total (i.e. Float32Array.BYTES_PER_ELEMENT * bigArray.length) on an 8Gb machine. That makes the tab crash 20% of times, and 100% if I try to inspect bigArray (e.g., try to get bigArray.length in console, log

Load perl modules automatically during runtime in Perl

老子叫甜甜 提交于 2020-01-15 06:34:44
问题 Is there a way to load entire modules during runtime in Perl? I had thought I found a good solution with autouse but the following bit of code fails compilation: package tryAutouse2; use autouse 'tryAutouse'; my $obj = tryAutouse->new(); I imagine this is because autouse is specifically meant to be used with exported functions, am I correct? Since this fails compilation, is it impossible to have a packaged solution? Am I forced to require before each new module invocation if I want dynamic