vnmakarov / yaep

Yet Another Earley Parser
Other
135 stars 13 forks source link

mm #5

Open effbiae opened 7 years ago

effbiae commented 7 years ago

What is the best way to make sure my application memory management doesn't interfere with the speed (or function) of yaep's memory management?

I'm not sure the best way to work with your memory manager (OS_CREATE etc)... yaep_parse has parse_alloc and parse_free functions (i read from yaep.txt that these functions are only used for the translation (*root) memory.

i note your test code (yaep.tst.in) defines

static void *
test_parse_alloc (int size)
{
  void *result;

  OS_TOP_EXPAND (mem_os, size);
  result = OS_TOP_BEGIN (mem_os);
  OS_TOP_FINISH (mem_os);
  return result;
}

and you pass yaep_parse and NULL for the yaep_parse functions

it seems you've optimized memory management and i don't feel as though i should use malloc/free in my own code in case i change your memory management characteristics.

but in the end, i'm going to link libyaep.a into code that uses malloc/realloc/free anyway, so...

what is the best way to make sure my application memory management doesn't interfere with the speed (or function) of yaep's memory management?