On 8/28/2020 1:39 PM, Corinna Vinschen wrote:
On Aug 28 12:02, Ken Brown via Cygwin wrote:
On 8/28/2020 9:36 AM, Corinna Vinschen wrote:
As POC, I added a bit of code to maintain a second array, which is only
allocated (using HeapAlloc so as not to spill into the child processes)

Should there be a call to HeapFree somewhere, or is there some reason this
isn't needed?

It's local memory in a single process, and it's allocated only once.
There's no reason to shrink or free this ever again.

It took a night's sleep for this to fully sink in, but I get it now. A class that allocates memory would normally have a destructor that frees the memory. But only one instance of this class is created per process, so there's no need for the destructor.

I'll send a patch with a comment in case you think it might be helpful to future readers of the code.

Ken
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to