Re: [pcre-dev] [Bug 1209] Calling pcre_free from C# causes a…

Top Page
Delete this message
Author: Zoltán Herczeg
Date:  
To: 1209, Rhodri Jenkins
CC: pcre-dev
Subject: Re: [pcre-dev] [Bug 1209] Calling pcre_free from C# causes a memory access violation
Hi Rhodri,

> This might be a basic question but if pcre_free is a function pointer is
> this used to supply a function pointer to the pcre code to be called when
> the pcre dll needs to delete the compiled pcre structure returned from
> pcre_compile? Am I correct to assume that I need to free the pcre
> structure returned by pcre_compile to avoid a memory leak?


I am not sure I fully understand your long sentence, but I think the answer is yes. Initially it points to a default function which do the free in general case, but you can redirect the alloc / free functions for your own application by changing those function pointers.

> normal unmanaged memory heap. I was thinking of extending the pcre3.dll by
> adding an exported C function that will free the structure. As this


I think that is the best option.

Regards,
Zoltan