FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 02-10-2008, 12:28 AM
"Aaron Griffin"
 
Default memleak caused by "don't duplicate package in cache"

On Feb 6, 2008 9:07 AM, Xavier <shiningxc@gmail.com> wrote:
> So, for solving this issue, maybe we would need a way to track down
> which packages were loaded in the cache. That should allow us to free
> everything correctly, which doesn't seem possible currently.
> We could then free in the trans_free function all targets that are not
> in the pkg cache. And the remaining targets that are in the pkg cache
> will be freed when the cache is freed.

I'm still a fan of handling this sort of thing internally to the list
structure, so we gain something like this:

struct alpm_list_head {
...
...
void (*free_func)(void*);
...
};

then the lists which require free-ing of the internal members have
this set and it is called on alpm_list_free() is non-NULL. Say, for
instance, the cache lists get a free_func = list_free_pkg, all the
packages would get free'd when the list is free'd

This way we could cover this case here, when we hit the case that the
packages need freeing, we simply set the free_func to be non-NULL and
that base is covered.

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 02-10-2008, 08:16 AM
Xavier
 
Default memleak caused by "don't duplicate package in cache"

Aaron Griffin wrote:
>
> I'm still a fan of handling this sort of thing internally to the list
> structure, so we gain something like this:
>
> struct alpm_list_head {
> ...
> ...
> void (*free_func)(void*);
> ...
> };
>
> then the lists which require free-ing of the internal members have
> this set and it is called on alpm_list_free() is non-NULL. Say, for
> instance, the cache lists get a free_func = list_free_pkg, all the
> packages would get free'd when the list is free'd
>
> This way we could cover this case here, when we hit the case that the
> packages need freeing, we simply set the free_func to be non-NULL and
> that base is covered.
>

But, here we have two different lists, cache_list and target_list which
share the same packages.
In the normal case, we have cache_list == target_list (they have the
same size, and share the same packages, but not the same nodes).
But an error can happen at any step. So we could have an empty
cache_list, or only one package in it, or two, etc..

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 

Thread Tools




All times are GMT. The time now is 07:13 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org