I have an array an a timer that adds a new object to my array every 5 seconds but am running into a slight issue. I have a code that is called repeatably which moves the objects in my array but for some reason the previous object that spawns will stop moving when a new object is spawned into my array. How do I make it so every single obj...
Still learning Objective-C / iPhone SDK here. I think I know why this wasn't working but I just wanted to confirm.
In awakeFromNib, if I use [[NSMutableDictionary alloc] initWithObjects:...] it actually allocates (iPhone) system memory with this NSMutableDictionary data, but when I use [NSMutableDictionary dictionaryWithObjects:...] it ...
I have a class with a static member like this:
class C
{
static Map m=new HashMap();
{
... initialize the map with some values ...
}
}
AFAIK, this would consume memory practically to the end of the program. I was wondering, if I could solve it with soft references, like this:
class C
{
static volatile SoftReference<Map> m...
hi i'm new in iphone programming and i just want some help. Could you identify potential memory link in my code ? thanks a lot.
ImageCache.h
#import <Foundation/Foundation.h>
#import <CommonCrypto/CommonDigest.h>
@interface ImageCache : NSObject {
}
+(NSString *)getMD5FromString:(NSString *)chaine;
+(UIImage *)getImageFromCacheWith...
Hi,
I am curious to know about the in details about how the malloc and free works.
int main()
{
unsigned char *p = (unsigned char*)malloc(4*sizeof(unsigned char));
memset(p,0,4);
strcpy((char*)p,"abcdabcd"); // **deliberately storing 8bytes**
cout << p;
free(p); // Obvious Crash, but I need how it works and why cra...
Hi. I want to reset an object. Can I do it in following way?
anObject->~AnObject();
anObject = new(anObject) AnObject();
// edit: this is not allowed: anObject->AnObject();
This code is obviously a subset of typical life cycle of an object allocated by in placement new:
AnObject* anObject = malloc(sizeof(AnObject));
anObject = new (a...
I want to make a virtual allocator using c++ on windows,, which allocate data on a file on the hard disk, to reduce physical memory usage when allocate large objects !..
I don't want to use system virtual memory with virtualAlloc.. . I want to create a file on the disk and use it to allocate the whole objects and then move the part or th...
Is there an advanced article which I can read that can explain how memory is allocated for different types (value and reference) in .net framework.
for example we know that value types are allocated space on a stack, but how is that managed?
Also how are reference types managed in a heap and where are the actual values stored. (Referen...
I came across this question about memory management of dictionaries, which mentions the intern function. What exactly does it do, and when would it be used?
To give an example:
If I have a set called seen, that contains tuples in the form (string1,string2), which I use to check for duplicates, would storing (intern(string1),intern(stri...
My query is how can i store data in secondary memory by fetching it from database and then displaying it in small units using zend framework coding ?
...
I'm using Core Data to store lists of data. So, there's parent objects with any number of child objects. Core Data does a great job keeping my memory use low while I'm inserting objects and reading but when I do a delete operation the memory spikes way up.
When I delete a parent object with ~5000 children the cascade delete uses ~10MB. ...
I have following simple class:
@interface Article: NSObject {
NSString *title;
}
@property (copy, nonatomic) NSString *title;
@end
@implementation
- (void)setTitle:(NSString *)aString {
if ((!title && !aString) || (title && aString && [title isEqualToString:aString])) return;
dirty = YES;
[title release];
title = [...
Okay, I have an app that tells me what color of pixel I touched by reading the screen (like a screenshot) after each touch. To retrieve the pixels, I use a method similar to that appearing here. But it seems that after each touch, the image data is still being held on to (and not to mention saving hundreds of unwanted screenshots in my p...
Are there any good(and free) tools for either analyzing static source or running programs to help detect memory leaks?
I've built some windows services and want to make sure the are not going to consume memory if I leave them running for weeks on end.
...
This is probably along the lines of http://stackoverflow.com/questions/698147/net-collections-and-the-large-object-heap-loh
In .Net, I'm loading an XmlDocument with a string that makes ~200KB text document when the xml is converted to base64. The point being, the string should be allocated to the large object heap. I know from reading...
I have some data processing code which uses the following recipe:
Read in as much data as will fit in memory (call this a 'chunk')
Perform processing on the chunk
Write out processed chunk to disk
Repeat
...
Merge all the processed chunks to get the final answer.
This last stage is most efficient when there are as few chunks as possi...
I have been looking through the questions asked on StackOverflow, but there are so many about memory management in Objective-C that I couldn't find the answer I was looking for.
The question is if it is ok (and recommnded) to call autorelease before adding a newly created object to a collection (like NSMutableArray)? Or should I release...
I've been playing around with iPhone development for a while, and although it feels a bit awkward when you're a "hard core" .NET developer, it's not all that bad once you get used to it.
In every book I read about Objective-C, there's only talk about retain/release (reference counting) for memory management. As an old-skool C/C++ develo...
Hi
I am trying to determine if an object is valid. The program has (at least) two threads and one of the threads might invalidate the object by removing it from an NSMutableArray. I need the other thread to check either its existence or validity before acting on it.
...
Unless you're programming parts of an OS or an embedded system are there any reasons to do so? I can imagine that for some particular classes that are created and destroyed frequently overloading memory management functions or introducing a pool of objects might lower the overhead, but doing these things globally??
Addition
I've just fo...