blueszhangsh / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

FreeLibrary is recommended to be implemented #159

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I ran into issues where we had plugins that are loaded, tested whether 
they apply to a context, then unloaded.  Unfortunately they are sometimes 
loaded again in our editor when the project settings change to require the 
plugin.  Essentially have an application that does rounds of 
loadlibrary/freelibrary.
2. Hit a check regarding dlls still being active.

What is the expected output? What do you see instead?
Expected that FreeLibrary being hooked and the list of dlls updated.  
Unfortunately reference counting isn't reliable as the initial dll 
reference count when they are first patched is unknown requiring snapping 
the module list.  

What version of the product are you using? On what operating system?
Perftools 1.3

Attached modified patch_functions file (may not be completely marked up 
with changes--it was getting really late).

Please provide any additional information below.

Original issue reported on code.google.com by escri...@hotmail.com on 21 Jul 2009 at 2:44

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the idea, and the push to patch FreeLibrary -- it looks like there's 
a
comment saying we could do it, but it wasn't actually done before.  I'd like to
implement it as part of PatchAllLibraries, rather than a separate function, so 
I may
not take your patch verbatim.  But I'll look to have this functionality in the 
next
release.

Original comment by csilv...@gmail.com on 22 Jul 2009 at 8:17

GoogleCodeExporter commented 9 years ago
Ok, I have another version of this patch that I think may work -- I don't know 
how to
test windows very well, but the unittests pass at least.  (Your version did some
copying-around that I don't know if it was safe if we ever decide to call 
Unpatch().)
 However, I don't believe any of the unittests call FreeLibrary, so I can't say if
the new code works.  In any case, I've included the new version of 
patch_functions.cc
here.  Do you want to give it a try and let me know how it looks?

Original comment by csilv...@gmail.com on 25 Jul 2009 at 1:13

Attachments:

GoogleCodeExporter commented 9 years ago
Any news on trying this new patch?  I don't really know how to test it myself, 
so I'm
hoping you can say if it seems to solve your problem!

Original comment by csilv...@gmail.com on 4 Aug 2009 at 1:02

GoogleCodeExporter commented 9 years ago
Another ping.  How well does the patch work?

Original comment by csilv...@gmail.com on 10 Aug 2009 at 6:56

GoogleCodeExporter commented 9 years ago
Hey there, sorry for the radio silence--we are in alpha at the moment and quite 
busy.  I haven't had a chance to pull it down and compare yet.  It may be a bit 
:(

Original comment by escri...@hotmail.com on 12 Aug 2009 at 4:35

GoogleCodeExporter commented 9 years ago
I ended up putting this into perftools 1.4, just released.  It's not well 
tested, but
I hope it works for you!

Original comment by csilv...@gmail.com on 11 Sep 2009 at 6:57