New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Critical: Clean Object Dictionary look over #1625
Comments
I'm familiarizing myself with the As best I can tell, the only call that actually stores items in the
Which is only ever used to register Should it not be the responsibility of the objects to unregister themselves, rather than checking retain counts and pulling them out? |
…e QSObject to allow for unregistering objects, and ensures that each QSObject unregisters itself in the dealloc method.
Something like this: |
Good question, that's what I was getting at with this 'discussion'. Basically that method would run when the interface is closed (and a few other cases) to wipe temporary objects that have been created. In reality, these objects should be wiped once they're not needed again. I.e. they should never be left dangling anywhere. Your solution looks interesting/good. I never thought about that. But will |
And about your following lines @craigotis - I think the reason some 'arbitrary' retain count of I think using Instruments would be a good idea to see where the objects are being retained after closing the interface. If it's just in the objectDictionary, then we kind of have a retain cycle going on. I'll take a look |
I was going to look in more detail later this morning, but my understanding is that the object dictionary is jut an in-memory cache to allow for quick access using |
Side-note: The fact that triggers for things not in the catalog work until a restart makes me think those objects were getting kept in the object dictionary somehow, too. We might break that functionality when we fix this, but maybe it's better for people to find out up-front that the trigger isn't viable. |
@pjrobertson You're right, if the @skurfer If the object dictionary is an in-memory cache used for quick lookups, then the question of course becomes, when are cache objects invalidated? Without the ability to track retain cycles, I think potential options include:
However: I should mention again that my first encounter with this class was about 2 hours ago, so feel free to scrutinize my options/solutions with extreme prejudice. :) |
my belief is that Maybe we could add a |
Still haven't looked at any code, so this could be nonsense, but if the things we care about are in the catalog and in the result array, they should be retained, right? So I wonder if it would be possible to make Long term, we should probably be asking |
Another side-note: We might have to dig in and actually figure out the bug I fixed with #1566, instead of just hacking around it by putting things back how they were. |
Here's the required "architecture" comment ;-):
|
The |
@tiennou I agree that the cache seems a weird thing to have, at least in its current form. @tiennou @pjrobertson Right - the objects weren't removed until their |
Just for kicks, I tried changing the test from using I was curious about what was getting released. Has anyone tried uncommenting the It also seems that a Who turned over this rock? |
Interesting idea - I see what you're trying to do: "if it's not in the catalog then remove it". Won't this break triggers? I guess you said it's not worth pursuing as you say…
Dunno. Whoever did, feel free to shoot him ;-) On 2 Oct 2013, at 22:14, Rob McBroom notifications@github.com wrote:
|
Because QSCommand looks like a late addition to the framework. Initially everything was done "in parts", (direct, action, indirect), and some parts really feel that way. I've been trying to consolidate that a little, but as I pointed out in the dev group, I'd really prefer not to go anywhere near QSObjectView & QSInterfaceController while still sober. Ideally QSInterfaceController should have a QSCommand ivar, its 3 search object views should have their object value bound to each QSCommand ivar. You can dig up the QSCommandInterfaceController in alcor's branch if you want to see "the future" ;-).
It shouldn't, because temporary objects in triggers are archived commands, which contains either an id or a complete archive to recreate the actual object, and this is retained by the command, so it's expected to go away. Unless something has got an ID that's more complex than text or a file path ;-).
|
|
Lol :) Maybe both you and Rob are right… what is the point of the cache? The only thing I can think of is duplicate objects: We have a "/Applications" QSFileObject in the Catalog. On 2 Oct 2013, at 22:30, Etienne Samson notifications@github.com wrote:
|
I’ve always thought it was important, but now I wonder. Patrick is right about the filesystem browsing example. Recreating files is expensive. I’ve added this line to
Feel free to do the same and see what you think. My inclination is to say that we need a lookup table like this. (Just not the one we have.) |
Welcome to mess-land ;-). Frankly, this is killing my brain. I've stormed around
Memory usage was all nice and clean (I'm seeing a surge from 497MB to 512MB when I do that, but it cleans itself up when the interface closes). Here's what I can see about the All in all, I'm thinking that maybe the On another note, I'm really wondering why we aren't asking the catalog for that identifier first (that's the point @pjrobertson made above about browsing from |
I noticed that, too. I think that should be changed to
Good point. Checking the catalog for an existing object will probably eliminate most of the expensive re-creation scenarios. But currently, The other stuff, like |
You guys... who needs all this chat when you can just use It seems to work. See bba31e6 I'm not too sure what Etienne was saying about needing the thing to be time based? It all seems to work fine - the relevant places hold on to the objects (the results list, etc) and so they stay in the objectDict. |
Oh I know what's wrong with this... the |
…time to drop 10.7 support? :) On 3 Oct 2013, at 03:35, Rob McBroom notifications@github.com wrote:
|
What's the general behavior if you just leave it out ? |
the number of objects being stored in FYI, here's the %age of requests to qs0.qsapp.com in September, by OS
|
|
See #1625 (comment) If we remove it all together (or do as I just did - comment out QSObject.m lines 147, 713 and 727) you get dupes in your catalog |
Hmm, then the only other solution I can think of is move the |
Yeah not a bad ideas. I looked into using MAWeakReferencing (look for it on GH, sorry in an iPod atm) and it's work with 10.7 but is non ARC so it's either use that non-ARC lib or our own. If we're not going to haul port 10.7 for too much longer then it's an easy temp fix
|
P.S. Just read that. I knew iOS autocorrect was bad, but not THAT bad. Apologies
|
I know the answer to this question changes nothing, but why is The category sounds like an OK idea. Could we just add something that returns retain count to the existing category on |
It's an illegal call because, even though you're allowed to ask (via a category), doing so would indicate you plan on acting on that information, which is what ARC is trying to avoid. The issue isn't specifically that ARC doesn't want you to be calling I think that the idea of removing an item from a cache, once it's only referenced by the cache, is inherently a code smell when you're using ARC. I think The Right Solution™ is to just drop the cache once the interface closes. Unless I'm mistaken, and I might be, isn't the interface the only thing that relies on it? Once you drop the cache, the items it was maintaining will automatically be purged as well. |
Yeah, you're probably right about all of that.
Not exactly. I think the interface just needs to make sure the objects in the result array stay around (and I think that already happens independent of this cache). There are other places that rely on the cache, but I think every single one is just getting an object that it expects to exist in the catalog. That goes back to what's already been said: We should be able to actually ask the catalog ( Should I take a crack at it? Is anyone working on this? |
Short of what I've done with the NSMapTable; nope. Feel free to go ahead :) On 8 Oct 2013, at 03:09, Rob McBroom notifications@github.com wrote:
|
OK. I've done something and it seems to be working. I want to test it out a bit (and I'll need to redo it in a cleaner way) before sharing. |
Awesome, nice work :) On 9 Oct 2013, at 22:01, Rob McBroom notifications@github.com wrote:
|
Also removes the defaultSearchSet, since it would just contain the dictionary’s values. related to #1625
Also removes the defaultSearchSet, since it would just contain the dictionary’s values. related to #1625
Fixed now the #1648 is merged. We still need to do logs of pre-release testing though |
Also removes the defaultSearchSet, since it would just contain the dictionary’s values. related to #1625
I've just stumbled across this today, and it's a biggy we shouldn't have overlooked when we merged the ARC stuff in. I seem to remember @craigotis mentioning it, so it's my bad for not raising it...
but the important code in
+[QSObject cleanObjectDictionary]
is commented out.This means objects aren't ever going to get released (theoretically)
You can see the memory increase (well, the object increase) if you:
print [(NSArray *)[objectDictionary allKeys] count]
in the debugger/usr/bin/
in QS (and/or any other place that makes lots of 'temporary' QSObjects)cleanObjectDictionary
to be called/any cleanup to be performed (it's called when the interface closes, no need to wait if you trust me :D)print [(NSArray *)[objectDictionary allKeys] count]
cleanObjectDictionary
was never the right way to go about this. But what it? :)The text was updated successfully, but these errors were encountered: