On Wed, 8 May 2013 15:53:26 +0900 Daniel Juyung Seo <seojuyu...@gmail.com> said:

> On Wed, May 8, 2013 at 2:48 PM, Carsten Haitzler <ras...@rasterman.com> wrote:
> > On Wed, 8 May 2013 13:46:08 +0900 Daniel Juyung Seo <seojuyu...@gmail.com>
> > said:
> >
> >> On Wed, May 8, 2013 at 12:11 PM, Carsten Haitzler <ras...@rasterman.com>
> >> wrote:
> >> > On Wed, 8 May 2013 11:20:27 +0900 Bluezery <ohpo...@gmail.com> said:
> >> >
> >> >> 2013/5/7 Carsten Haitzler <ras...@rasterman.com>
> >> >>
> >> >> > On Tue, 7 May 2013 17:32:05 +0900 Bluezery <ohpo...@gmail.com> said:
> >> >> >
> >> >> > > Hello,
> >> >> > >
> >> >> > > I have query abount elm_genlist_item_class_new/free/unref.
> >> >> > >
> >> >> > > Elm_Genlist_Item_Class is user created memory and referred by
> >> >> > > genlist object.
> >> >> > >
> >> >> > > But sometimes application want to do not use it anymore.
> >> >> > > So there is just one option to do this, it is to call
> >> >> > > elm_genlist_item_class_free.
> >> >> > > Evenghough, Item Class callbacks can be called because genlist refer
> >> >> > > the Item Class yet. Moreover, if application is module,  application
> >> >> > > can
> >> >> > crash
> >> >> > > after module is unloaded.
> >> >> > >
> >> >> > > There is two options:
> >> >> > > 1.I can add new API to do this.elm_genlist_item_class_free2 or
> >> >> > > something. This is easy way but should be deprecaed later.
> >> >> > >
> >> >> > > 2. In elm_genlist_item_class_free(), all calbacks can be NULL
> >> >> > > because the name is too intuitive for application. But this will
> >> >> > > break ABI and also genlist example in elementary should be changed.
> >> >> > >
> >> >> > > 3. All application fix their own to set all callbacks as NULL before
> >> >> > > unloaded.
> >> >> > > But this seems to be workaround for application.
> >> >> > >
> >> >> > > I like option 2. So I suggest how about above fix be added at the
> >> >> > > time
> >> >> > when
> >> >> > > 1.8 is released. I think that this weired API usage should be fixed
> >> >> > > ASAP. Or after 2.0?
> >> >> >
> >> >> > #3.
> >> >> >
> >> >> > free frees, but the class is refcounted.. so it stays around and
> >> >> > alive as long
> >> >> > as items need it. they all point to it.
> >> >> >
> >> >>
> >> >> Okay, I see. If app. use class longer, app. should decide timing to call
> >> >> item_free function.
> >> >> Also for the case such as module, app. can set the callbacks as NULL
> >> >> before unloaded.
> >> >
> >> > well in 99% of cases the app or lib doesnt need to null out the funcs.
> >> > the code is and always will be in memory. ONLY *IF* you are going to
> >> > dlclose() libs and remove code from memory do you need to do this...
> >>
> >> Agreed. Also if we really should call dlclose(), we can postpone
> >> dlclose() until genlist's EVAS_CALLBACK_FREE is called.
> >> This will solve issue easily.
> >>
> >> >
> >> > just fyi... i highly advise not to dlclose(). it won't save memory as the
> >> > code is paged in from disk as needed.. and if those pages are no longer
> >> > accessed they will be freed from memory when the kernel needs those pages
> >> > for something else. it just makes things LOOK better temporarily when u
> >> > look at vsize/rss.
> >>
> >> Well dlclose() is just a temporarily fake in this case :)
> >> Btw, if we call dlopen() many times without dlclose(), what happens?
> >> It will consume more memory any way.
> >
> > libraries loaded are refcounted, so its the same mmaping for 2 or more
> > dlopens, so it consumes no more memory. see "man dlopen". specifically:
> >
> 
> Well I didn't mean it. Let me change my question.
> What if the app dlopens many libraries like this?

if it dlopens the same lib 10 times that 1 lib is in memory once only. if 100
apps load that same lib 10 times each.. that lib is in memory once only across
ALL apps. (i'm ignoring rw sections btw - those will be one per process even if
loaded 10 times... and until written they are COW (copy on write)).

> I briefly counted UGs from https://review.tizen.org/git/
> And it's fourteen.

way too much to look at. :)

> Well maybe this is not too much? :)
> 
> >        If the same library is loaded again with dlopen(), the same file
> > handle is returned.  The dl library maintains  reference  counts  for
> > library handles,  so  a  dynamic library is not deallocated until dlclose()
> > has been called on it as many times as dlopen() has succeeded on  it.   The
> >        _init()  routine,  if  present,  is only called once.  But a
> > subsequent call with RTLD_NOW may force symbol resolution for  a  library
> > earlier loaded with RTLD_LAZY.
> >
> >
> >> Daniel Juyung Seo (SeoZ)
> >>
> >>
> >> >
> >> >> > > Thanks
> >> >> > >
> >> >> > > --
> >> >> > > BRs,
> >> >> > > Kim.
> >> >> > >
> >> >> > ------------------------------------------------------------------------------
> >> >> > > Learn Graph Databases - Download FREE O'Reilly Book
> >> >> > > "Graph Databases" is the definitive new guide to graph databases and
> >> >> > > their applications. This 200-page book is written by three acclaimed
> >> >> > > leaders in the field. The early access version is available now.
> >> >> > > Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> >> >> > > _______________________________________________
> >> >> > > enlightenment-devel mailing list
> >> >> > > enlightenment-devel@lists.sourceforge.net
> >> >> > > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >> >> > >
> >> >> >
> >> >> >
> >> >> > --
> >> >> > ------------- Codito, ergo sum - "I code, therefore I am"
> >> >> > -------------- The Rasterman (Carsten Haitzler)
> >> >> > ras...@rasterman.com
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >> --
> >> >> BRs,
> >> >> Kim.
> >> >> ------------------------------------------------------------------------------
> >> >> Learn Graph Databases - Download FREE O'Reilly Book
> >> >> "Graph Databases" is the definitive new guide to graph databases and
> >> >> their applications. This 200-page book is written by three acclaimed
> >> >> leaders in the field. The early access version is available now.
> >> >> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> >> >> _______________________________________________
> >> >> enlightenment-devel mailing list
> >> >> enlightenment-devel@lists.sourceforge.net
> >> >> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >> >>
> >> >
> >> >
> >> > --
> >> > ------------- Codito, ergo sum - "I code, therefore I am" --------------
> >> > The Rasterman (Carsten Haitzler)    ras...@rasterman.com
> >> >
> >> >
> >> > ------------------------------------------------------------------------------
> >> > Learn Graph Databases - Download FREE O'Reilly Book
> >> > "Graph Databases" is the definitive new guide to graph databases and
> >> > their applications. This 200-page book is written by three acclaimed
> >> > leaders in the field. The early access version is available now.
> >> > Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> >> > _______________________________________________
> >> > enlightenment-devel mailing list
> >> > enlightenment-devel@lists.sourceforge.net
> >> > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >>
> >> ------------------------------------------------------------------------------
> >> Learn Graph Databases - Download FREE O'Reilly Book
> >> "Graph Databases" is the definitive new guide to graph databases and
> >> their applications. This 200-page book is written by three acclaimed
> >> leaders in the field. The early access version is available now.
> >> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> >> _______________________________________________
> >> enlightenment-devel mailing list
> >> enlightenment-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >>
> >
> >
> > --
> > ------------- Codito, ergo sum - "I code, therefore I am" --------------
> > The Rasterman (Carsten Haitzler)    ras...@rasterman.com
> >
> 


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    ras...@rasterman.com


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to