I am writing a program which redraws a graph every so often. Unfortunately it seems that for some reason core graphics does not seem to release the previous graphic so I run into memory problems fast. How can I force it to release memory at the end of each draw?
Not that this is not a memory leak as the memory does get released when I l...
Hi,
I have a memory management-related question in a multithreaded iPhone application.
Let's say we have this method, that is called in a separate thread than the main-UI-thread:
- (BOOL)fetchAtIndex:(NSUInteger)index
{
NSURL *theURL = [NSURL URLWithString:[queryURLs objectAtIndex:index]];
// Pay attention to this line:
NSD...
My Java application runs another Java application, by running the process "java -jar j.jar". J.jar is known to use a LOT of memory depending on the dataset it is given, and often gets an OutOfMemoryError heap. So I want to use -Xmx on it, so that I can allocate as much memory as possible (or close to). I was thinking of getting the total...
Is there any way to detect when an NSView will be dealloc'ed?
The reason is, I have some simple delegates (such as an NSTextField delegate that handles -control:textView:doCommandBySelector: to allow the return/tab keys to be entered). I'd like to just stick this delegate object in the nib, wire up the NSTextField's delegate connection...
Hi,
I'd like to write my own memory manager. The target language is C++ and the goal of the memory manager is mainly to help debugging. It should detect double frees, memory overwrite and so on. And of course - I'd like to learn about memory management.
Can someone give me a hint so resources where I can learn how to write such a memor...
Can I create an object of my class in stack regarding .net and C#?
For example:
class abc { int i=1; }
abc a1=new abc();
Now, here the object is created in heap. So, is there any way to create the object in stack memory of ram if the size of object is not big?
...
Considering internal memory usage
input = web_service.FullCompanyListChunksGet(x, ChunkSize);
ReadXML(input);
should take the same memory as
ReadXML(web_service.FullCompanyListChunksGet(x, ChunkSize));
Doesn't it? Do both samples pass just the reference to the ReadXML Method?
Please help me understanding the difference. Thanks
...
On UNIX, I can, for example, tell the OS that the mapping will be needed in the future with posix_fadvise(POSIX_FADV_WILLNEED). It will then read-ahead the data if it feels so.
How to tell the access intend to Windows ?
...
If I declare
PSomeStruct = ^TSomeStruct;
TSomeStruct = record
s1 : string;
end;
and I run the following code:
var
p: PSomeStruct;
begin
new(p);
p^.s1:= 'something bla bla bla';
dispose(p);
the FastMM 4 memory manager reports that there was a memory leak (type: string, data dump: "something bla bla bla"). However, if I ...
From wikipedia:
"Segmentation cannot be turned off on
x86 processors, so many operating
systems use a flat memory model to
make segmentation unnoticeable to
programs. For instance, the Linux
kernel sets up only 4 segments"
I mean since protection is already taken care of by the virtual memory subsystem (PTEs have a protec...
Possible Duplicates:
How can I get the size of an array from a pointer in C?
Is there any way to determine the size of a C++ array programmatically? And if not, why?
I get a pointer to a chunk of allocated memory out of a C style function.
Now, it would be really interesting for debugging purposes to know how
big the allocate...
So I thought I had all these questions all figured out. Then all of a sudden i get an error (a crash) i can't figure out. THen after doing research to remedy the crash, i notice everything that I thought i knew about these critical areas are somewhat wrong.
Below are 8 questions im just going to shoot out there in hopes of somebody answ...
I have a Win XP 32 bit machine . I am using Visual C++ language to test this scenario .
I create a vector like vector<__int64> v . I take a note of virtual memory , say its 400 KB now. Then I push around 5 million integers in it . Now I note the virtual memory , its increased to say around 900 KB . Now I call a erase or clear on the vect...
my application is crashing very much how do i find the error through nszombie..?
could someone tell me step by step guide to use nszombie or valgrind tool to find memory error ,refrence error etc.
...
In C/C++ we can store variables, functions, member functions, instances of a class either on a stack or a heap.
How is each implemented? How is it managed (high level)? Does gcc preallocates a chunk of memory to be used for the stack and heap, and then doles out on request? Is original memory coming from RAM?
Can a function be allo...
I'm starting to understand memory management better in objective-c, but there's something I don't understand. This is a property declaration:
@property (nonatomic, retain)UILabel *myLabel;
and this is its unseen synthesized setter (I think):
- (void)setMyLabel:(UILabel *)newValue {
if(myLabel != newValue) {
[myLabel relea...
How to release this variable with no EXC_BAB_ACCESS ?
//First line create memory leak
UIImage *ImageAvatar = [[UIImage alloc] initWithData:[myg.imageData copy]];
Moins1 = ImageAvatar;
//[ImageAvatar release]; if i release-> EXC_BAD_ACCESS
Moins1 is a menber of the interface is declared like this :
UIImage *Moins1;
...
@property (non...
Possible Duplicates:
How is heap and stack memories mananged, implemented, allocated?
Stack,Static and Heap in C++
In C/C++ we can store variables, functions, member functions, instances of a class either on a stack or a heap.
How is each implemented? How is it managed (high level)? Does gcc preallocates a chunk of memory to...
I want my application to never just crash stupidly. I know that code quality is the root solution for this. But I still need an application to never crash when some unexpected bug happens. Here is code I want to try.
-(void)testException
{
@try
{
NSString* str;
[str release];
}
@catch(NSException* ex)
...
First of all, i have never seen so many memory issues in my app since i started placing "self" everywhere after reading an article about how memory behaves in obj-C. Now, im getting all kinds of issues (reveals the sloppiness of my coding). Granted I am a newbie at Objective-C, i'll admit i have never had so much issues with memory manag...