Fossil

Check-in [58a02a2e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Documenting the Label structure I introduced.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | label_linkedlist
Files: files | file ages | folders
SHA1: 58a02a2e4adae108ef28c599fb1e7445a2b01c34
User & Date: viriketo 2011-09-06 20:30:26
Context
2011-09-13
16:43
Getting in the changes reducing the leak on annotate. In the fossil mailing list, I received only opinions in favour of getting mallocs and frees properly paired, so I think noone will refuse the change. check-in: 7870a89b user: viriketo tags: annotate_noleak
2011-09-06
20:30
Documenting the Label structure I introduced. Closed-Leaf check-in: 58a02a2e user: viriketo tags: label_linkedlist
2011-09-04
22:14
Implementation of a linked list to solve the memory leak described in a TODO in [e2ebb1f5cae8].

This code is slower than having the memory leak, and at the end, it was not a big memory leak. Let's say, 10 byte per revision involved in a file annotate. If a file has 30000 revisions, it may go around 300KB then.

For this leak to be noticeable (as we have a content cache until 50MB), it would mean having above a milion revisions for the file annotated.

So, I keep this in a branch apart, as maybe the leak is worth the faster code. I have not measured the speed difference though. check-in: ef8266b7 user: viriketo tags: label_linkedlist

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/diff.c.

617
618
619
620
621
622
623














624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
}

/**************************************************************************
** The basic difference engine is above.  What follows is the annotation
** engine.  Both are in the same file since they share many components.
*/















/*
** The status of an annotation operation is recorded by an instance
** of the following structure.
*/
typedef struct Annotator Annotator;
struct Label
{
    struct Label *prev;
    struct Label *next;
    char *str;
    int nref;
};
struct Annotator {
  DContext c;       /* The diff-engine context */
  struct AnnLine {  /* Lines of the original files... */
    const char *z;       /* The text of the line */
    short int n;         /* Number of bytes (omitting trailing space and \n) */
    short int iLevel;    /* Level at which tag was set */
    struct Label *zSrc;    /* Tag showing origin of this line */







>
>
>
>
>
>
>
>
>
>
>
>
>
>





<
<
<
<
<
<
<







617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642







643
644
645
646
647
648
649
}

/**************************************************************************
** The basic difference engine is above.  What follows is the annotation
** engine.  Both are in the same file since they share many components.
*/

/*
** Linked list of strings, labels used in the annotator code.
** The elements of the list and the pointed string (str)
** will be freed once they become totally unreferenced
** (nref == 0).
*/
struct Label
{
    struct Label *prev;   /* previous element */
    struct Label *next;   /* next element */
    char *str;            /* The label string */
    int nref;             /* Number of references to the string */
};

/*
** The status of an annotation operation is recorded by an instance
** of the following structure.
*/
typedef struct Annotator Annotator;







struct Annotator {
  DContext c;       /* The diff-engine context */
  struct AnnLine {  /* Lines of the original files... */
    const char *z;       /* The text of the line */
    short int n;         /* Number of bytes (omitting trailing space and \n) */
    short int iLevel;    /* Level at which tag was set */
    struct Label *zSrc;    /* Tag showing origin of this line */