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

Etusivu
Poista viesti
Lähettäjä: Rhodri Jenkins
Päiväys:  
Vastaanottaja: pcre-dev
Aihe: [pcre-dev] [Bug 1209] Calling pcre_free from C# causes a memory access violation
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1209




--- Comment #2 from Rhodri Jenkins <rjenkins22@???> 2012-02-13 20:07:36 ---
Hi Zoltan

Thanks for answering my query.

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?

The problem I have is C# uses a reserved memory heap or managed heap and I
will have difficulty deleting the pcre structure as it will reside in the
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
function is running outside the unmanaged memory it should be able to free
the structure without a memory access violation . If I try to release the
memory from inside C# I get a memory access violation exception thrown.

Rhodri Jenkins
Application Architect

07901715788

CSC ? This is a PRIVATE message. If you are not the intended recipient,
please delete without copying and kindly advise us by e-mail of the
mistake in delivery. NOTE: Regardless of content, this e-mail shall not
operate to bind CSC to any order or other contract unless pursuant to
explicit written agreement or government initiative expressly permitting
the use of e-mail for such purpose ? CSC Computer Sciences Limited ?
Registered Office: Royal Pavilion, Wellesley Road, Aldershot, Hampshire,
GU11 1PZ, UK ? Registered in England No: 0963578




From:   Zoltan Herczeg <hzmester@???>
To:     Rhodri L Jenkins/GBR/CSC@CSC
Date:   09/02/2012 16:37
Subject:        [Bug 1209] Calling pcre_free from C# causes a memory 
access violation
Sent by:        admin@???




------- You are receiving this mail because: -------
You are on the CC list for the bug.
You reported the bug.

http://bugs.exim.org/show_bug.cgi?id=1209

Zoltan Herczeg <hzmester@???> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hzmester@???





--- Comment #1 from Zoltan Herczeg <hzmester@???> 2012-02-09
16:39:53 ---
I suspect this is incorrect:

private static extern void pcre_free(IntPtr re);

If VPCOMPAT is not defined the symbol is a function pointer not a
function:

PCRE_EXP_DECL void (*pcre_free)(void *);

Although I know nothing of C fence.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email