You will be able to download the videos without annoying ads. Keep in mind that the download links are watermarked but this does not affect .Q:
How to draw straight line between two points on iOS?
I am looking for an iOS library to draw straight line between two points (I need to draw between two points on screen). Is there any Cocoa touch library available?
A:
- (void)drawLines:(UIView *)theView {
CGContextRef context = UIGraphicsGetCurrentContext();
CGPoint firstPoint = CGPointMake(0, 0);
CGPoint secondPoint = CGPointMake(100, 100);
CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor);
CGContextSetLineWidth(context, 5);
CGContextAddLineToPoint(context, firstPoint.x, firstPoint.y);
CGContextAddLineToPoint(context, secondPoint.x, secondPoint.y);
CGContextStrokePath(context);
}
Q:
What happens when memory is allocated in a file?
I have a question regarding memory allocation. If I allocate memory in a file as such:
int* foo;
*foo = malloc(5);
What happens if the file is deleted later?
I know that if the memory is not associated with an object, the memory will be reclaimed by the system (assuming there's not more memory available). In this case, how do you go about cleaning up the memory?
A:
If you are only referring to dynamic memory, that's already allocated as part of the executable file itself. You are just malloc()-ing from the same place your code is being run from. After the code has run, the memory won't be returned to the heap, but the OS can and will reclaim it when you close the file. (Note that even if you close the file without freeing the memory, it will be released when the program terminates or, if memory is a concern, there will be a "paging-in" done by the OS to keep the executable code in memory as long as possible.)
If you are referring to static memory, there is no such thing as be359ba680
Related links:
Comments