View Issue Details

IDProjectCategoryView StatusLast Update
0000674LDMudRuntimepublic2009-09-16 05:28
Reporter_xtian_ Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
Summary0000674: memleak: copying self referencing mappings
DescriptionAvalon is being plagued by a memleak and baba@avalon seems to have found its cause: copying a mapping that holds a self-reference. Now tracking memleaks is difficult, but I am appending some code in the hopes that you will be able to reproduce it in an isolated environment.
Additional Information// memleak.c
mapping m; // global to not obfuscate my output

void leak()
{
  mapping n;

  printf("starting ...\n");

  m=([]);
  m["self"]= m; // set self reference

  n= deep_copy(m); // this is the leak, leads to ref-counter being off
}

void pre()
{
  printf("preparing ...\n");
  efun::garbage_collection(); // clean slate
}

void post()
{
  printf("post ...\n");
  efun::garbage_collection("MEMLEAK");
  printf("done.\n");
}

void create()
{
  pre();
  leak();
  post();
}
TagsNo tags attached.
External Data (URL)

Activities

_xtian_

2009-09-16 05:28

reporter   ~0001268

After some discussion on d-chat:

a) self-referencing in general is the problem
b) there is no trivial way to efficiently check for self-refcounts when creating/deleting the self-referencing data, which I would need here (not at GC time!)
c) Although Im still hoping that this may be adressed someday in the future, on the short-term we should not use self-referencing data in LPC

Issue History

Date Modified Username Field Change
2009-09-16 03:33 _xtian_ New Issue
2009-09-16 05:28 _xtian_ Note Added: 0001268