JuhaHeiskala / DirectQhull.jl

MIT License
11 stars 5 forks source link

missing qh_free_qh to avoid memory leaks? #8

Closed dgleich closed 1 year ago

dgleich commented 1 year ago

Apologies if this is an oversight, but I see a number of qh_alloc_qh statements, but I don't see any corresponding qh_free_qh statements anywhere.

So at the moment, I assume this library leaks memory over time.

JuhaHeiskala commented 1 year ago

No oversight, lack of discipline.... Please, feel free to make a PR. Presumably, registering a finalizer for qhT should make it work with Julia's GC.

dgleich commented 1 year ago

Okay, will try and submit something soon. Thanks for getting this all started. Was looking at doing something similar myself and then I discovered your package :)

Will try and submit a PR for the qh_free work! There here are some qh_memfree things I think we need too, ... since QH can allocate its own memory internally.

JuhaHeiskala commented 1 year ago

@stevengj has the below comment in accessors.c in qhull.

   Note: qh_freeqhull and qh_memfreeshort should be called before calling qh_free_qh. */
void qh_free_qh(qhT *qh) {
  qh_free(qh);
}