Re: dealloc not called for FxPlug
Re: dealloc not called for FxPlug
- Subject: Re: dealloc not called for FxPlug
- From: Roman Kudinov <email@hidden>
- Date: Wed, 24 May 2017 13:29:44 +0300
Peter,
I had the similar problem in my plugin for Premire Pro. One of the prior
versions of PPro for OSX also had this bug - they didn't call
appropriate deinit functions on exit. I've created a C++ class and
defined it globally on stack. C++ class destructor will be called for
sure when a program exits and stack is being deallocated. That C++ class
managed all my resources, e.g. I registered resource allocation,
deallocation with it and additionally it deallocated all with left
references in its destructor.
Yes, PPro plugins are pure C, while FxPlug is Objective-C, but I believe
if you compile codes as Objective-C++ then this will run properly.
--
Roman
Darrin,
During shutdown, the apps do not free every piece of memory that they
allocated.
I've asked before and have filed bug reports: –dealloc was NOT be called
on the apiManager object for each time initWithAPIManager invocation.
I complained because we were not having all resource management code being
called properly. In particular we needed to tell our floating license
server (in another process) to release any licenses upon exit, which can
only be done by a deallocation of the apiManager object we create for our
plug-in (and needs to be done for each invocation of initWithApiManager for
a balanced set of calls).
So not calling –dealloc on our apiManager object doesn't give us this chance
to setup and release our licenses in a balanced way.
So what is the proposed proper way for us to "undo" what we did in "init"
in a balanced way?
Pete
From: Pro-apps-dev
<pro-apps-dev-bounces+pete=email@hidden> on behalf of
Darrin Cardani <email@hidden>
Date: Monday, May 22, 2017 at 2:25 PM
To: Daniel Walz <email@hidden>
Cc: pro-apps-dev <email@hidden>
Subject: Re: dealloc not called for FxPlug
Daniel,
You should not directly call -dealloc on your ThemeLibrary object. You
should call -release. It probably won’t cause any problems, but it could in
theory.
That said, what you are seeing is normal. During shutdown, the apps do not
free every piece of memory that they allocated. Since the operating system
will free all memory used by the app’s process, the apps just quit and let
the OS reclaim the memory rather than manually going through every object
and deallocating them. This significantly speeds up shutdown times for
users.
Darrin
On May 22, 2017, at 5:47 AM, Daniel Walz <email@hidden> wrote:
Hi everybody,
I have a FxGenerator plugin and I allocate a C++ class in the init method. I
test that in a project with one instance on the timeline. I get two calls to
init (using NSLog debugging), but only one dealloc when closing Final Cut,
hence my LeakDetector goes off.
Maybe it is due to my limited ObjC knowledge, this is my first ObjC project...
Is there something I did wrong? Or is it a FinalCut mistake?
Here is the relevant code:
- (id)initWithAPIManager:(id)apiManager
{
(void)@protocol(MyFxPlugRegistration);
self = [super init];
_apiManager = apiManager;
_registeredPlugin = YES;
themeLibrary = [[ThemeLibrary alloc] init];
NSLog (@"created MyFxPlug");
return self;
}
- (void)dealloc
{
NSLog (@"dealloc MyFxPlug");
// Clean up
[themeLibrary dealloc];
[super dealloc];
}
Thanks for helping,
Daniel
--
Daniel Walz | Software Developer
Filmstro | Music that Moves.
www.filmstro.com <http://www.filmstro.com/> | twitter/filmstro
<https://twitter.com/filmstro> | vimeo/filmstro <https://vimeo.com/filmstro>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Pro-apps-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Best regards,
Román Kudinov
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Pro-apps-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden