memory-management

ActionScript - Difference Between Primitive / Non-Primitive Objects for Memory Management?

寵の児 提交于 2020-01-27 20:59:05
问题 my understanding is that primitive types ( uint, string, Number, etc. ) of a class do not need to be set to null for garbage collection. for example, i am not required to write this dispose() method in the following class: package { //Imports import flash.display.Shape; //Class public class DrawSquare extends Shape { //Properties private var squareColorProperty:uint; //Constructor public function DrawSquare(squareColor:uint) { squareColorProperty = squareColor; init(); } //Initialize private

iOS6 MKMapView using a ton of memory, to the point of crashing the app, anyone else notice this?

十年热恋 提交于 2020-01-26 09:38:45
问题 Has anyone else, who's using maps in their iOS 6 apps, noticing extremely high memory use to the point of receiving memory warnings over and over to the point of crashing the app? I've ran the app through instruments and I'm not seeing any leaks and until the map view is created the app consistently runs at around ~3mb Live Bytes. Once the map is created and the tiles are downloaded the Live Bytes jumps up to ~13mb Live Bytes. Then as I move the map around and zoom in and out the Live Bytes

Better to load resources on the run or to pre load them on memory?

狂风中的少年 提交于 2020-01-25 18:55:08
问题 I'm developing an app that spans across several classes, and as such, I've had to pass on the app's Context to all of the classes that use global strings or integers so as to extract them from the strings.xml or dimens.xml files instead of hard coding them. Up until now I've been loading the resources once needed but I was wondering if it would be more efficient to load all the resources I would need on a class in the Constructor, keep in mind that they're only strings and integer values. 回答1

How to correctly dispose of injected DLL thread?

时光怂恿深爱的人放手 提交于 2020-01-24 21:49:12
问题 I'm injecting a DLL into a target process to act as a helper while playing an MMORPG (currently functionality converts key press into mouse clicks, as the MMORPG requires the user to move their mouse for certain functionality, something I despise.) Let's say I want to uninject my DLL for whatever reason, how would I go about it? Is this method clean? bool running = true; while (running) // This is the only thread I'm using, and it is running in "realtime" { // Do keyboard handing stuff in

In C#, is it possible to cast a byte array into another type without creating a new array?

扶醉桌前 提交于 2020-01-24 21:08:48
问题 I have a byte[] object that I'm using as a data buffer. I want to "read" it as an array of a either primitive/non-primitive structs without duplicating the byte[] data in memory. The goal would be something like: byte[] myBuffer; //Buffer is populated int[] asInts = PixieDust_ToInt(myBuffer); MyStruct[] asMyStructs = PixieDust_ToMyStruct(myBuffer); Is this possible? If so, how? 回答1: You will not be able to do this. To have a MyStruct[] you'll need to actually create such an array of that type

Need assistance regarding UIViewController

不问归期 提交于 2020-01-24 19:28:52
问题 In an application where several UIViewControllers work together, firstViewController added to root. Till here its fine now I want to go to secondViewController I dont want to use UINavigationController or UITabBarController . I have already read the View Controller Programming Guide but it does not specify without using UINavigationController, UITabBarController and story board . and when user want to move from secondViewController to firstViewController how secondViewController will be

why is java taking long time initializing two dimensional arrays starting with the first dimension having a big size number?

▼魔方 西西 提交于 2020-01-24 04:01:21
问题 I have noticed that initializing 2D array like this case 1 :- int ar [] [] = new int [10000001][10] ; taking more time than initializing it like this case 2 :- int ar[] [] = new int [10] [10000001] ; in case 1 it toke time around 4000ms but in case 2 it does not exceed 100ms why there is this big gap ? 回答1: Strictly speaking, Java does not have 2D arrays: instead, it uses 1D arrays arranged into 1D arrays of arrays. In your first case, in addition to the single array of arrays, Java makes

28 extra bytes in bss

强颜欢笑 提交于 2020-01-24 04:01:07
问题 struct abc { char cc[32]; } mystruct; int main() { } When I run the above program, the .bss section has 64 bytes. I was expecting it to be 36 bytes . 32 bytes for mystruct and 4 bytes which is taken by other libraries. If I change char cc[32] to char cc[31] then I get 36 bytes in .bss. -bash-3.00$ g++ bssSize.cc -bash-3.00$ readelf --sections ./a.out | grep bss [23] .bss NOBITS 08049580 000578 000040 00 WA 0 0 32 -bash-3.00$ 64 is 000040 in hex Why are these extra 28 bytes there in .bss ? 回答1

Does Xcode's Debug Navigator work different from Instruments allocations?

你说的曾经没有我的故事 提交于 2020-01-24 03:54:29
问题 I'm trying to find memory issues in my app. When I use Xcode's debug navigator for memory issues I see increase in the overall usage of the application. For a specific flow, when I go back and forth I don't see memory being persisted. However if I go through same flow and instrument using Allocations, I do see 3Mbs getting persisted every time I go back and forth. Is Xcode's debug navigator not reliable or they're measuring something different or something else?! EDIT: So I've been told the

Save functions for re-using without re-execution

我的未来我决定 提交于 2020-01-24 01:39:10
问题 I tried to find some kind of things that allow to "save functions" such as: Once running the program (included some functions) and we will save functions's address in memory after that, we can re-use these functions without execution any more. Could you give me some ideas (in general or particular in Python, C/C++,...). I have googled this but I didn't get it :(. I was thinking of some kind of memory management (allocation, freedom of memory, resident memory...I guess) For example: I have a