Search Results

Search found 12267 results on 491 pages for 'out of memory'.

Page 141/491 | < Previous Page | 137 138 139 140 141 142 143 144 145 146 147 148  | Next Page >

  • C instruction address

    - by aaa
    hello. Disclaimer, I not do anything in particular with regards this question, just curious. Is it possible to take address of instruction or block in C? in essence, is there jump equivalent in C? for example: void function() { int k; { // is a possible to go to this address from arbitrary point in code? int i, j; k += j+i; } } thank you

    Read the article

  • Global variable not stable after platform changed.

    - by user350555
    Our embedded system is built on a hw/sw platform made by enea. After the platform updated recently, we found some operations on the global variable keep crashing the system. For example, we have a global map structure holding some data. We can insert/iterate the map once or twice, then the address of the elements in the map suddenly changed to some forbidden addresses like 0x0 or 0x1d, the system just crash. The only different before/after the platform update is : 1) sw part: It's a c++ software and We changed the compiler from diab cc to gcc. 2) hw part: we have a new board, but the cpu is still powerpc405s. I tried every possible way but still can't figure out the reason. Any thoughts?

    Read the article

  • Make sense of Notification Watcher source objective-c

    - by Chris
    From Notification Watcher source. - (void)selectNotification:(NSNotification*)aNotification { id sender = [aNotification object]; [selectedDistNotification release]; selectedDistNotification = nil; [selectedWSNotification release]; selectedWSNotification = nil; NSNotification **targetVar; NSArray **targetList; if (sender == distNotificationList) { targetVar = &selectedDistNotification; targetList = &distNotifications; } else { targetVar = &selectedWSNotification; targetList = &wsNotifications; } if ([sender selectedRow] != -1) { [*targetVar autorelease]; *targetVar = [[*targetList objectAtIndex:[sender selectedRow]] retain]; } if (*targetVar == nil) { [objectText setStringValue:@""]; } else { id obj = [*targetVar object]; NSMutableAttributedString *objStr = nil; if (obj == nil) { NSFont *aFont = [objectText font]; NSDictionary *attrDict = italicAttributesForFont(aFont); objStr = [[NSMutableAttributedString alloc] initWithString:@"(null)" attributes:attrDict]; } else { /* Line 1 */ objStr = [[NSMutableAttributedString alloc] initWithString: [NSString stringWithFormat:@" (%@)", [obj className]]]; [objStr addAttributes:italicAttributesForFont([objectText font]) range:NSMakeRange(1,[[obj className] length]+2)]; if ([obj isKindOfClass:[NSString class]]) { [objStr replaceCharactersInRange:NSMakeRange(0,0) withString:obj]; } else if ([obj respondsToSelector:@selector(stringValue)]) { [objStr replaceCharactersInRange:NSMakeRange(0,0) withString:[obj performSelector:@selector(stringValue)]]; } else { // Remove the space since we have no value to display [objStr replaceCharactersInRange:NSMakeRange(0,1) withString:@""]; } } [objectText setObjectValue:objStr]; /* LINE 2 */ [objStr release]; } [userInfoList reloadData]; } Over at //LINE 2 objStr is being released. Is this because we are assigning it with alloc in //LINE 1? Also, why is //LINE 1 not: objStr = [NSMutableAttributedString* initWithString:@"(null)" attributes:attrDict] If I create a new string like (NSString*) str = [NSString initWithString:@"test"]; ... str = @"another string"; Would I have to release str, or is this wrong and if I do that I have to use [[NSString alloc] initWithString:@"test"]? Why isn't the pointer symbol used as in [[NSString* alloc] ...? Thanks

    Read the article

  • How do I fix "java.lang.OutOfMemoryError at sun.misc.Unsafe.allocateMemory(Native Method)"?

    - by Jephir
    I'm making a Java application that uses the Slick library to load images. However, on some computers, I get this error when trying to run the program: Exception in thread "main" java.lang.OutOfMemoryError at sun.misc.Unsafe.allocateMemory(Native Method) at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:99) at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288) at org.lwjgl.BufferUtils.createByteBuffer(BufferUtils.java:60) at org.newdawn.slick.opengl.PNGImageData.loadImage(PNGImageData.java:692) at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:62) at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:43) My VM options are: -Djava.library.path=lib -Xms1024M -Xmx1024M -XX:PermSize=256M -XX:MaxPermSize=256M The program loads a few large images (1024 x 768 resolution) at the beginning. Any help to solve this problem would be greatly appreciated.

    Read the article

  • std::string constructor corrupts pointer

    - by computergeek6
    I have an Entity class, which contains 3 pointers: m_rigidBody, m_entity, and m_parent. Somewhere in Entity::setModel(std::string model), it's crashing. Apparently, this is caused by bad data in m_entity. The weird thing is that I nulled it in the constructor and haven't touched it since then. I debugged it and put a watchpoint on it, and it comes up that the m_entity member is being changed in the constructor for std::string that's being called while converting a const char* into an std::string for the setModel call. I'm running on a Mac, if that helps (I think I remember some problem with std::string on the Mac). Any ideas about what's going on?

    Read the article

  • NSCFType keeps occurring, something is not being released?

    - by user1493543
    I'm attempting to delete files from the documents directory using a tableview/array combination. For some reason, my NSString pointing to the Documents directory path is being converted to a NSCFType (which after some research, I understand is happening because a variable is not being released). Because of this, the application crashes at the line NSString *lastPath = [documentsDirectory stringByAppendingPathComponent:temp]; claiming that NSCFType cannot recognize the method stringByAppendingPathComponent. I would appreciate if someone could help me out (I hope I have explained this clearly enough). - (void) tableView: (UITableView *) tableView commitEditingStyle: (UITableViewCellEditingStyle) editingStyle forRowAtIndexPath: (NSIndexPath *) indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { NSString *temp = [directoryContent objectAtIndex:indexPath.row]; NSLog(temp); NSString *lastPath = [documentsDirectory stringByAppendingPathComponent:temp]; [[NSFileManager defaultManager] removeItemAtPath:lastPath error:nil]; - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); documentsDirectory = [paths objectAtIndex:0]; directoryContent = [[[NSFileManager defaultManager] contentsOfDirectoryAtPath:documentsDirectory error:nil] retain]; //tableview handling below }

    Read the article

  • Can I set Java max heap size for running from a jar file?

    - by Kip
    I am launching a java jar file which often requires more than the default 64MB max heap size. A 256MB heap size is sufficient for this app though. Is there anyway to specify (in the manifest maybe?) to always use a 256MB max heap size when launching the jar? (More specific details below, if needed.) This is a command-line app that I've written in Java, which does some image manipulation. On high-res images (about 12 megapixels and above, which is not uncommon) I get an OutOfMemoryError. Currently I'm launching the app from a jar file, i.e. java -jar MyApp.jar params... I can avoid an OutOfMemoryError by specifying 256MB max heap size on the command line, i.e.: java -Xmx256m -jar MyApp.jar params... However, I don't want to have to specify this, since I know that 256MB is sufficient even for high-res images. I'd like to have that information saved in the jar file. Is that possible?

    Read the article

  • Is there any advantage to having more than 16gb ram on a Windows Dev machine?

    - by Robert Kozak
    Assuming a machine (Dual Quad Core Xeon (2.26GHz) with 24GB RAM) running Windows Server 2008 and Hyper-V. How many VMs can I expect to run at the same time with good performance. Is this overkill? Can you really have too much RAM? Assuming 2GB per VM thats around 16GB for the VMs with 8GB left over for the Main OS and Hyper-V. Sound about right? Edit: Tried to make the question sound less like bragging. Was never my intention. Its a hard question to write.

    Read the article

  • How to analyse Dalvik GC behaviour?

    - by HRJ
    I am developing an application on Android. It is a long running application that continuously processes sensor data. While running the application I see a lot of GC messages in the logcat; about one every second. This is most probably because of objects being created and immediately de-referenced in a loop. How do I find which objects are being created and released immediately? All the java heap analysis tools that I have tried(*) are bothered with the counts and sizes of objects on the heap. While they are useful, I am more interested in finding out the site where temporary short-lived objects get created the most. (*) I tried jcat and Eclipse MAT. I couldn't get hat to work on the Android heap-dumps; it complained of an unsupported dump file version.

    Read the article

  • Compiler reordering around mutex boundaries?

    - by shojtsy
    Suppose I have my own non-inline functions LockMutex and UnlockMutex, which are using some proper mutex - such as boost - inside. How will the compiler know not to reorder other operations with regard to calls to the LockMutex and UnlockMutex? It can not possibly know how will I implement these functions in some other compilation unit. void SomeClass::store(int i) { LockMutex(_m); _field = i; // could the compiler move this around? UnlockMutex(_m); } ps: One is supposed to use instances of classes for holding locks to guarantee unlocking. I have left this out to simplify the example.

    Read the article

  • Should I always release self for failed init methods?

    - by leo
    Should I always release self when there is a failure inside init, or should I only do so if I have initialized instance variables first? To put it another way, is this pattern valid? Is there a time when I shouldn't release self inside an init method, or should I assume that if the control flow enters init, self has at least a retain count of 1? - (id)init { if ((self = [super init]) == nil) { [self release]; return nil; } //do some init stuff if (somethingFailed) { [self release]; return nil; } return self; }

    Read the article

  • How to track dealloc of an abstract object class (NSMutable...)

    - by Thomas Tempelmann
    I have a bug in my code caused by a premature freeing of a ObjC object. I seem not to be able to find it by just looking at my code. There's usually a simple trick to track the dealloc to any class: Implement dealloc, and set a breakpoint. This even usually works with standard objects, by subclassing them and making sure I instantiate the subclass instead of the standard class. However, this does not seem to work with NSMutableArray, and probably neither with similar NSMutable... classes. Some explanations for this can be found here: link text Any other ideas how to track the dealloc invocation of a particular class or object so that I can see the call stack? It's probably possible with DTrace. Any pointers without having to read the entire dtrace docs first?

    Read the article

  • UI Thread .Invoke() causing handle leak?

    - by JYelton
    In what circumstances would updating a UI control from a non-UI thread could cause the processes' handles to continually increase, when using a delegate and .InvokeRequired? For example: public delegate void DelegateUIUpdate(); private void UIUpdate() { if (someControl.InvokeRequired) { someControl.Invoke(new DelegateUIUpdate(UIUpdate)); return; } // do something with someControl } When this is called in a loop or on timer intervals, the handles for the program consistently increase.

    Read the article

  • Static Analyzer says I have a leak....why?

    - by Walter
    I think this code should be fine but Static Analyzer doesn't like it. I can't figure out why and was hoping that someone could help me understand. The code works fine, the analyzer result just bugs me. Coin *tempCoin = [[Coin alloc] initalize]; self.myCoin = tempCoin; [tempCoin release]; Coin is a generic NSObject and it has an initalize method. myCoin is a property of the current view and is of type Coin. I assume it is telling me I am leaking tempCoin. In my view's .h I have set myCoin as a property with nonatomic,retain. I've tried to autorelease the code as well as this normal release but Static Analyzer continues to say: 1. Method returns an Objective-C object with a +1 retain count (owning reference) 2. Object allocated on line 97 is no longer referenced after this point and has a retain count of +1 (object leaked) Line 97 is the first line that I show.

    Read the article

  • Is the scope of what Xcode's "Build and Analyze" will catch as a leak supposed to be this limited?

    - by Ranking Stackingblocks
    It doesn't care about this: NSString* leaker() { return [[NSString alloc] init]; } I thought it would have been smart enough to check if any code paths could call that function without releasing its return value (I wouldn't normally code this way, I'm just testing the analyzer). It reports this as a leak: NSString* leaker() { NSString* s = [[NSString alloc] init]; [s retain]; return s; } but NOT this: NSString* leaker() { NSString* s = [[NSString alloc] init]; // [s retain]; return s; } which seems particularly weak to me. Does it only analyze within the local scope? If the tool can't pick up on things like this, how can I expect it to pick up on actual mistakes that I might make?

    Read the article

  • How can CopyOnWriteArrayList be thread-safe?

    - by Shooshpanchick
    I've taken a look into OpenJDK's sources of CopyOnWriteArrayList and it seems that all write operations are protected by the same lock and read operations are not protected at all. As I understand, under JMM all accesses to a variable (both read and write) should be protected by lock or reordering effects may occur. For example, set(int, E) method contains these lines (under lock): /* 1 */ int len = elements.length; /* 2 */ Object[] newElements = Arrays.copyOf(elements, len); /* 3 */ newElements[index] = element; /* 4 */ setArray(newElements); The get(int) method, on the other hand, only does return get(getArray(), index);. In my understanding of JMM, this means that get may observe the array in an inconsistent state if statements 1-4 are reordered like 1-2(new)-4-2(copyOf)-3. Do I understand JMM incorrectly or is there any other explanations on why CopyOnWriteArrayList is thread-safe?

    Read the article

  • Surprising IPhone leak

    - by Ethan
    Hey guys, So I'm running instruments on my app, and getting a leak that I could have sworn I was doing right. + (NSMutableArray *)decode:(NSDictionary *)encoded_faculty_array { NSArray *faculty_id_data = [encoded_faculty_array objectForKey:@"faculty_id"]; NSArray *faculty_first_name = [encoded_faculty_array objectForKey:@"first_name"]; NSArray *faculty_last_name = [encoded_faculty_array objectForKey:@"last_name"]; NSMutableArray* faculty_array = [[NSMutableArray alloc] init]; for(int a = 0; a < [faculty_id_data count]; a++) { Faculty *new_fac = [[Faculty alloc] initWithFacultyId:[Dearray clean:[faculty_id_data objectAtIndex:a] withDefault:@"0"] andFirstName:[Dearray clean:[faculty_first_name objectAtIndex:a] withDefault:@"Name not found"] andLastName:[Dearray clean:[faculty_last_name objectAtIndex:a] withDefault:@" "] andBio:nil andDegrees:nil andTitle:nil]; [faculty_array addObject:new_fac]; [new_fac release]; } [faculty_array autorelease]; return faculty_array; } It's reporting a leak on new_fac. I released it immediately after I called it though. Any idea what could be causing that problem? Thanks.

    Read the article

  • Dereferencing deleted pointers always result in an Access Violation ??

    - by m3rLinEz
    I have a very simple C++ code here: char *s = new char[100]; strcpy(s, "HELLO"); delete [] s; int n = strlen(s); If I run this code from Visual C++ 2008 by pressing F5 (Start Debugging,) this always result in crash (Access Violation.) However, starting this executable outside the IDE, or using the IDE's Ctrl+F5 (Start without Debugging) doesn't result in any crash. What could be the difference? I also want to know if it's possible to stably reproduce the Access Violation crash caused from accessing deleted area? Is this kind of crash rare in real-life?

    Read the article

  • Objective C: Why is this code leaking?

    - by Johnny Grass
    I'm trying to implement a method similar to what mytunescontroller uses to check if it has been added to the app's login items. This code compiles without warnings but if I run the leaks performance tool I get the following leaks: Leaked Object # Address Size Responsible Library Responsible Frame NSURL 7 < multiple > 448 LaunchServices LSSharedFileListItemGetFSRef NSCFString 6 < multiple > 432 LaunchServices LSSharedFileListItemGetFSRef Here is the responsible culprit: - (BOOL)isAppStartingOnLogin { LSSharedFileListRef loginListRef = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL); if (loginListRef) { NSArray *loginItemsArray = (NSArray *)LSSharedFileListCopySnapshot(loginListRef, NULL); NSURL *itemURL; for (id itemRef in loginItemsArray) { if (LSSharedFileListItemResolve((LSSharedFileListItemRef)itemRef, 0, (CFURLRef *) &itemURL, NULL) == noErr) { if ([[itemURL path] hasPrefix:[[NSBundle mainBundle] bundlePath]]) { [loginItemsArray release]; CFRelease(loginListRef); return YES; } } } [loginItemsArray release]; CFRelease(loginListRef); } return NO; }

    Read the article

  • object not getting released in iphone

    - by Jaimin
    i m writing this code in my code to store the data in database.. Search *objSearchDetail = [[Search alloc] init]; objSearchDetail = [xmlResponseDetail objectAtIndex:i]; sql = "INSERT INTO tblsearchdetail(tblrecentsearch_id,name,address,email,url,street,postcode,city,telephone,mobile) VALUES(?,?,?,?,?,?,?,?,?,?)"; returnValue = sqlite3_prepare_v2(database, sql, -1, &insertStatement, NULL); if(returnValue == SQLITE_OK){ sqlite3_bind_int(insertStatement, 1, intLastRecentSearchId); sqlite3_bind_text(insertStatement, 2, [objSearchDetail.strName UTF8String], -1,SQLITE_TRANSIENT); sqlite3_bind_text(insertStatement, 3, [objSearchDetail.strAddress UTF8String], -1,SQLITE_TRANSIENT); sqlite3_bind_text(insertStatement, 4, [objSearchDetail.strEmail UTF8String], -1,SQLITE_TRANSIENT); sqlite3_bind_text(insertStatement, 5, [objSearchDetail.strUrl UTF8String], -1,SQLITE_TRANSIENT); sqlite3_bind_text(insertStatement, 6, [objSearchDetail.strStreet UTF8String], -1,SQLITE_TRANSIENT); sqlite3_bind_text(insertStatement, 7, [objSearchDetail.strPostCode UTF8String], -1,SQLITE_TRANSIENT); sqlite3_bind_text(insertStatement, 8, [objSearchDetail.strPlace UTF8String], -1,SQLITE_TRANSIENT); sqlite3_bind_text(insertStatement, 9, [objSearchDetail.strTelephone UTF8String], -1,SQLITE_TRANSIENT); sqlite3_bind_text(insertStatement, 10, [objSearchDetail.strMobile UTF8String], -1,SQLITE_TRANSIENT); if(sqlite3_step(insertStatement)==SQLITE_DONE) { //Data; } } NSLog(@"count %d",[objSearchDetail retainCount]); [objSearchDetail release]; now the nslog shows refrence count as 2 so even if i release the refrence count will still be one and the object will not be destroyed.. plz help me....

    Read the article

< Previous Page | 137 138 139 140 141 142 143 144 145 146 147 148  | Next Page >