IP_ADAPTER_INFO *ptr=new IP_ADAPTER_INFO[100];
if i free using
delete ptr;
will it lead to memory leak, if not then why ?
This is disassembly code generated by VS2005
**delete ptr;**
0041351D mov eax,dword ptr [ptr]
00413520 mov dword ptr [ebp-0ECh],eax
00413526 mov ecx,dword ptr [ebp-0ECh]
0041352C ...
Hello.
I have been using shared pointers for soem time now, and I have performance issues in my program... So I'd like to know if shared pointers lead to performance decrease. If so, then how hard? Thanks alot.
My program is multi-threaded, using std::tr1::shared_ptr
...
I've created a 2d array of c-strings using :
char ** my_array = new char*[N];
and then I initialized each row using :
my_array[i] = new char[M]; // where M is a varying number. assign values to my_array[i] later
So I pretty much got a jagged 2d array.
I wanted to proceed and delete the whole thing like this :
for(int i = 0; i < N...
If I am adding an item to a dictionary like this:
[connectionHandlers setObject:projectsHandler forKey:[NSNumber numberWithInt:PROJECTS_CONNECTION_ID]];
Should I be retaining the NSNumber used for the key.
Also, when an object is added to an NSArray or NSDictionary, is it retained by the Array or Dictionary when added and released wh...
What do you think about the concept of using ORO instead of traditional Garbage Collecting? It doesn't seem to be widely adopted, and is more or less argumentative, but it can provide these benefits as I know:
Synchronous execution of code: your program will always take known amoun of time to execute.
Simplification of platform, you'r ...
In Windows, how can I keep track of the file mapping objects created by CreateFileMapping()? Basically I want to know how many memory mapped files are in use and the
information like their names, sizes, etc. Thanks!
...
I have written some Objective-C test cases. A typical looks the following:
- (void) test_size_Equals_Excpectation_After_initWithSize
{
int size = 10;
Buffer* buff = [[Buffer alloc] initWithSize:size];
GHAssertEquals([buff size], size, nil);
}
Buffer alloc returns buffer with reference count 1, I didn't care to call autore...
I'm writing a report and presentation for my college titled "Protection runtime program in RAM. Examples of work with the protected program." I'm using Linux.
I divided my report into two parts:
Description of technology managed RAM OS Linux - Allocated memory for applications - Protection stack for one application from other applica...
I'm attempting to craft my own basic singly linked list in C++ as a learning exercise, and I'm encountering some difficulty in the memory management department. As it stands I have...
A 'Node' class:
class Node
{
public:
char *value;
Node *next;
Node();
~Node();
};
Node::Node()
{
}
Node::~Node()
{
delete[] value;
...
Is the following true?
When the app is about to quit, it's
not necessary to clean up the memory
by calling release on all your
retained objects, because the iPhone
OS will reclaim the memory it
allocated for your app when you
launched it. This is faster and safer
than rely on the apps to correctly
clean up after thems...
I have the following designated initializer:
-(id) initWithName:(NSString*)name;
and the following default initializer:
-(id) init { return [self initWithName:@"foo"]; }
What kind of object does the designated initializer receive than? A released or a autoreleased?
given the following initializer:
-(id) init { return [self initWi...
I have an application which I've developed which queries Active Directory information and stores about 15 properties into a Datatable which is kept in memory.
I need to decrease the amount of "Commit" memory it is setting aside.
The application stays active in the system tray and allows for quick searching of information along with pic...
Don't shoot me, I know this must have been asked a thousand times...
I am not comfortable with the lack of good documentation on Objective-C memory. I understand alloc, dealloc, retain, release and all that but there is some confusion left in my head.
Is it just lazy programming or does Objective-C do some 'behind the scenes' automagi...
As is common knowledge, calls to alloc/copy/retain in Objective-C imply ownership and need to be balanced by a call to autorelease/release. How do you succinctly describe where this should happen? The word "succinct" is key. I can usually use intuition to guide me, but would like an explicit principle in case intuition fails and that can...
Hi.
The simplest code ever in Objective-C causes weird behavior:
#import Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSObject *obj = [[NSObject alloc] init];
NSLog(@"retain count %d",[obj retainCount]);//print 1
[obj release];//obj dea...
I have a list element which is populated via a query, this is then run through a for loop which sends this list to the front end, a jsp and prints them.
Wanted to know if by calling the list.clear() outside the for loop, it will clear the list object, so will this lead to better memory management? or should one use the weakhashmap for ...
I would like to understand garbage collection in objective-c.
I know how to work with memory in C-like languages and in languages where I don't care about memory. But I don't understand when to use autorelease, retain, dealloc and everything else, so I get errors and memory leaks.
Could someone propose me a good tutorial to understand ...
While working on my code lately, I've noticed that some of the memory usage is going up significantly, and I can't see many reasons for it in my code. So I'm wondering if there are any programs, techniques, or other types of tools that can scan my code (Delphi) and estimate for me what procedures, functions, and functions will be the he...
In the future, will managed runtimes provide additional protections against subtle data corruption issues?
Managed runtimes such as Java and the .NET CLR reduce or eliminate the possibility of many memory corruption bugs common in native languages like C#. Nonetheless, they are surprisingly not immune from all memory corruption problems...
I'm working on my first app and have a few questions on memory management.
First Question:
I'm working on an intro scene that looks like this
#import "Intro_Scene.h"
#import "Main_Menu.h"
#import "Label.h"
@implementation Intro_Scene
@synthesize logo,label;
-(id) init
{
self = [super init];
if(self != nil)
{
//Load logo image...