Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: XS: free() outside of the main thread causes crash on Windows

by BrowserUk (Patriarch)
on Sep 25, 2014 at 07:01 UTC ( [id://1101905]=note: print w/replies, xml ) Need Help??


in reply to XS: free() outside of the main thread causes crash on Windows

This works on Linux and crashes on Windows.

I'm very surprised that it even builds on Windows given that Windows doesn't support pthreads.

How is it resolving #include <pthread.h>; and therefore pthread_create() & pthread_join()?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: XS: free() outside of the main thread causes crash on Windows
by OlegG (Monk) on Sep 25, 2014 at 07:21 UTC

      I strongly suggest that you should compile your code with /E or equivalent to produce the post-preprocessor code and take a look at what is actually being call for malloc() and free(); because it almost certainly isn't the appropriate CRT routines.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        It says that free() is win32_free() and malloc() is win32_malloc().
      Have you heard of perlclib? It advocates using Newx() and Safefree() instead of malloc/free
        Yes. I made following changes:
        -free(msg); +Safefree(msg); -char *thread_arg = malloc((strlen(msg)+1)*sizeof(char)); +char *thread_arg; +Newx(thread_arg, strlen(msg)+1, char);
        But this didn't help. Still crashes
Re^2: XS: free() outside of the main thread causes crash on Windows (mingw)
by Anonymous Monk on Sep 25, 2014 at 07:09 UTC
    mingw as always
    citrusperl\mingw\mingw32\pthreads-win32\i686-w64-mingw32\lib\libpthrea +d.a citrusperl\mingw\mingw32\pthreads-win32\i686-w64-mingw32\include\pthre +ad.h

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1101905]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-03-28 13:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found