memory

Memory Question

I have some code that results in a EXC_BAD_ACCESS error: recordIDAsString = [ NSString stringWithFormat:@"%i", (int)abRecord.recordID ]; propertyIDAsString = [ NSString stringWithFormat:@"%i", (int)abProperty.propertyID ]; identifierAsString = [ NSString stringWithFormat:@"%i", (int)abProperty.identifier ]; recordIDAsString, proper...

A simple C++ question on memory usage

What is the difference (memory wise) bewteen: for(int x=0;x<100;x++) { int y = 1+x; } and int y = 0; for(int x=0;x<100;x++) { y = 1+x; } I've always wondered if they are the same or the first is a waste of memory?... ...

Detect CPU Speed/Memory/Internet Speed using Java?

Is it possible within Java to identify the total CPU speed available as well as the total system memory? Network connection speed to the web would also be awesome. ...

Where are methods stored in memory?

I learned that class fields are stored in the heap, but where are methods stored? In the heap or somewhere else? are they inline? ...

How to get binary dump of SQLite memory db

Hello! If i have code like this $dbSL = Zend_Db::factory('pdo_sqlite', array('dbname'=>':memory:')); $dbSL->query('CREATE TABLE ...'); $dbSL->query('CREATE TABLE ...'); ... After that i whant take binary dump of this SQLite db Thx in advice! ...

Memory usage large arrays puzzle in java

Hello to all and good day, I want to test how much memory takes a class(foo) in java.In the constructor of foo I have the followings new: int 1 = new int[size] int 2 = new int[size] .... int 6 = new int[size] The size begins from 100 and increases until 4000. So my code is: Runtime r = Runtime.getRuntime(); for(int i=0;i<10;i++) r.g...

Efficient, Reliable Active Objects Count

Is there a mechanism for getting a reliable value for the number of active objects in a Ruby environment? I've found several approaches to produce an answer, and typically they resemble: c = 0 ObjectSpace.each_object { c += 1 } The unfortunate problem with this is that there's a large number of Fixnum objects created simply to tabu...

Pre-allocate space for C++ STL queue

I'm writing a radix sort algorithm using queues and I would like to have a STL queue allocate space before I start adding things to the queue so that I can avoid constant dynamic resizing operations. Even though this doesn't exist, I want something with the effect of... queue<int> qs(N); for(int i=0;i<N;++i) qs.push(rand()); in su...

Does Mysql Text DataType reserves any memory space

Hi All, I want to know if mysql TEXT data type reserves any space even if there is no data in that row? I am little confuse. Can anyone provide me any input on this. Thanks in advance. ...

Scala: Mutable vs. Immutable Object Performance - OutOfMemoryError

I wanted to compare the performance characteristics of immutable.Map and mutable.Map in Scala for a similar operation (namely, merging many maps into a single one. See this question). I have what appear to be similar implementations for both mutable and immutable maps (see below). As a test, I generated a List containing 1,000,000 s...

return by value inline functions

I'm implementing some math types and I want to optimize the operators to minimize the amount of memory created, destroyed, and copied. To demonstrate I'll show you part of my Quaternion implementation. class Quaternion { public: double w,x,y,z; ... Quaternion operator+(const Quaternion &other) const; } I want to know how...

Objective-C class instance zeroed at alloc?

Is there any kind of memory-zeroing objective-c undertakes on my behalf when I first allocate a class instance? I see a lot of objective-c code out there that presumes their outlets are nil by default. If I do the same am I basing such behavior on false pretenses? ...

How to enable ARMv6 unaligned access on WinMobile6?

ARMv6 introduce a great feature - unaligned memory access, which make some things in code much more simplier and faster. But microsoft gives API for it only in winCE6. And most PDAs now based on WinMobile6 (which is on CE 5.x). And unaligned access is disabled by default :( I've try to set unaligned flag in CP15 register, but this doesn...

strategies to fix runtime errors

Hi, I was wondering what strategies you guys are using to fix runtime errors? Really appreciate if you could share some tips! Here is some of my thought (possibly with the help of gdb): when runtime error happens because some memory is wrongly accessed, is the address stored in the dumped core showing where the memory is? If I can fi...

Can running 'cat' speed up subsequent file random access on a linux box?

Hi all, on a linux box with plenty of memory (a few Gigs), I need to access randomly to a big file as fast as possible. I was thinking about doing a cat myfile > /dev/null before accessing it so my file pages go in memory sequentially, hence faster than with a dry random access. Does this approach make sense to you? ...

Does going out of scope like this free the associated memory?

I was just wondering, in the following scenarion, is the memory used by 'stringvar' freed after method1 is done executing? // Just some method void method2(char* str) { // Allocate 10 characters for str str = malloc(10 * sizeof(char)); } // Just another method void method1() { char* stringvar; method2(stringvar); // Is the m...

iPhone memory management Question

Hi , i m new to iPhone programming. i am very confused... plz help .. i have a list of questions. 1. - (void){ ClassOne *ob = [[ClassOne alloc] init]; // do i should use autorelease here ? self.O = ob; [ob release]; // is this correct ?? } or -(void)dealloc{ [O release]; // is this correct ?? } which one will release ob ?...

Custom Cell from nib leaking

I have a subclass of UITableViewCell and am trying to use it. At the moment it does display fine as a test but I get leaking errors to the console... - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CustomCellIdentifier = @"CustomCellIdentifier "; ...

Memory Leak Copying data From server

for (int i=0; i<[images count] ;i++) { url=@"http://192.168.0.101/titan/titanimages/"; url=[url stringByAppendingString:[images objectAtIndex:i]]; //NSData *imageData=[[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:url]]; NSData *imageData=[NSData dataWithContentsOfURL:[NSURL URLWithString:url]]; destinationPath=[document...

How to determine JVM memory footprint with multiple processes on Linux

Hi, I’m trying to quantify the difference in memory footprint of a small java app performing the same process multithreaded vs multiprocess. All my tests are on Linux. When running multithreaded, it is relatively easy to determine the overall footprint and additional overhead per thread. When running the single threaded process, the J...