- calloc/free suffer from damage on TerminateThread()
- use PerlMemShared (as originally planned) now fixed
- avoid doing anything important on DLL "detach".
p4raw-id: //depot/perlio@8001
#if defined(PERL_OBJECT)
PerlMem_free(this);
#else
-# if defined(PERL_IMPLICIT_SYS) && defined(WIN32)
+# if defined(WIN32)
+# if defined(PERL_IMPLICIT_SYS)
void *host = w32_internal_host;
- if (PerlProc_lasthost())
+ if (PerlProc_lasthost()) {
PerlIO_cleanup();
+ }
PerlMem_free(aTHXx);
win32_delete_internal_host(host);
+#else
+ PerlIO_cleanup();
+ PerlMem_free(aTHXx);
+#endif
# else
PerlMem_free(aTHXx);
# endif
#define PERL_IN_PERLIO_C
#include "perl.h"
-#undef PerlMemShared_calloc
-#define PerlMemShared_calloc(x,y) calloc(x,y)
-#undef PerlMemShared_free
-#define PerlMemShared_free(x) free(x)
-
-
#ifndef PERLIO_LAYERS
int
PerlIO_apply_layers(pTHX_ PerlIO *f, const char *mode, const char *names)
* process termination or call to FreeLibrary.
*/
case DLL_PROCESS_DETACH:
-#if !defined(PERLIO_IS_STDIO) && !defined(USE_SFIO)
- PerlIO_cleanup();
-#endif
+ /* As long as we use TerminateProcess()/TerminateThread() etc. for mimicing kill()
+ anything here had better be harmless if:
+ A. Not called at all.
+ B. Called after memory allocation for Heap has been forcibly removed by OS.
+ PerlIO_cleanup() was done here but fails (B).
+ */
EndSockets();
#if defined(USE_THREADS) || defined(USE_ITHREADS)
if (PL_curinterp)