Releasing Memory when using "TrivialThreads"
Releasing Memory when using "TrivialThreads"
- Subject: Releasing Memory when using "TrivialThreads"
- From: John Nairn <email@hidden>
- Date: Wed, 14 Aug 2002 10:05:24 -0600
I was finally able to get distributed objects working following the
outline in the "TrivialThreads" example. The comments in that example
mention that it does not clean up the threads. Is there information on
that process? It seems complex, especially when the threads are in a
multi-document application. Here is what I observe
Application Notes
There are two types of documents. One has a document class
(TextDocument) and its window has a window controller (TextController).
I set up a connection in TextController (along the lines of
TrivialThreads) to connect with a calculation class called RunServer.
There is a second type of document for plotting (PlotDocument) which
does not use a window controller. The calculations in RunServer may
create one or more PlotDocuments while running. If plots are created,
they are created by a message back to the main thread (i.e. in
TextController) when needed so no AppKit calls are in RunServer.
1. I can configure to run unthreaded and all objects release as
expected. Closing a plot document releases the PlotDocument and its
views. Closing a text document releases TextDocument and TextController
and RunServer (released by TextController).
2. When the program is multithreading, closing windows releases almost
nothing. Closing a text document gets TextDocument released but
TextController never gets released (and hence RunServer never gets
released).
3. Closing plot documents is stranger. If RunServer creates on plot
document (and leaves it around as is normal), when the plot window is
closed, nothing is released. However, if another call to RunServer
creates a new plot document, the previously-closed window is belatedly
releases. If RunServer creates several plots (by running several times
and leaving the windows opened) they release correctly except for the
last one which acts like a single plot window above. Finally, if the
text window is closed, the remaining plot window is never released when
closed.
Any suggestions would be appreciated on how to handle memory leaks in
multi-document (and multiple document types) applications when using
connected threads or distributed objects for each document.
----------------
John Nairn (1-801-581-3413, FAX: 1-801-581-4816)
Web page:
http://www.mse.utah.edu/~nairn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.