Re: [PATCHv4 10/12] notes.c: Implement simple memory pooling of leaf nodes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 27, 2009 at 03:43, Johan Herland<johan@xxxxxxxxxxx> wrote:
> When allocating a new memory pool, the older pool is leaked, but this is
> no worse than the current situation, where (pretty much) all leaf_nodes
> are leaked anyway.

Could you return the unused nodes back into tghe mempool?
By making the pool a preallocated list, perhaps?

And then it is trivial to provide a deallocation function for the mempool,
which something really concerned about the memleak can call (like when
or if libgit get more usable in an application context).

> @@ -95,7 +112,6 @@ static struct leaf_node *note_tree_find(struct int_node *tree, unsigned char n,
>                        /* unpack tree and resume search */
>                        tree->a[i] = NULL;
>                        load_subtree(l, tree, n);
> -                       free(l);

free_leaf_node(l), which returns the node into mempool

>                        return note_tree_find(tree, n, key_sha1);
>                }
>                break;
> @@ -118,7 +134,6 @@ static struct leaf_node *note_tree_find(struct int_node *tree, unsigned char n,
>                /* unpack tree and resume search */
>                tree->a[0] = NULL;
>                load_subtree(l, tree, n);
> -               free(l);

free_leaf_node(l);

>                return note_tree_find(tree, n, key_sha1);
>        }
>        return NULL;
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]