Fix typos in new locking on MemShared
authorNick Ing-Simmons <nik@tiuk.ti.com>
Sat, 20 Oct 2001 22:23:53 +0000 (22:23 +0000)
committerNick Ing-Simmons <nik@tiuk.ti.com>
Sat, 20 Oct 2001 22:23:53 +0000 (22:23 +0000)
Make buffers in PerlIOBuf_* in per-thread heap (they are cloned after all...)
- seems to make segfaults more deterministic - suspect they are
  attempt to free() after Interp and Host have gone.

p4raw-id: //depot/perlio@12541

perlio.c
win32/perlhost.h

index c33045c..f1cddb3 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -3058,7 +3058,7 @@ PerlIOBuf_close(PerlIO *f)
     IV code = PerlIOBase_close(f);
     PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
     if (b->buf && b->buf != (STDCHAR *) & b->oneword) {
-       PerlMemShared_free(b->buf);
+       safefree(b->buf);
     }
     b->buf = NULL;
     b->ptr = b->end = b->buf;
@@ -3093,7 +3093,8 @@ PerlIOBuf_get_base(PerlIO *f)
     if (!b->buf) {
        if (!b->bufsiz)
            b->bufsiz = 4096;
-       b->buf = PerlMemShared_calloc(b->bufsiz, sizeof(STDCHAR));
+       b->buf = 
+       Newz('B',b->buf,b->bufsiz, STDCHAR);
        if (!b->buf) {
            b->buf = (STDCHAR *) & b->oneword;
            b->bufsiz = sizeof(b->oneword);
@@ -4222,3 +4223,4 @@ PerlIO_sprintf(char *s, int n, const char *fmt, ...)
     return result;
 }
 #endif
+
index 268a112..cd433fd 100644 (file)
@@ -78,7 +78,7 @@ public:
        void *result;
        GetLockShared();
        result = m_pVMemShared->Malloc(size);
-       FreeLockShared()
+       FreeLockShared();
        return result;
     };
     inline void* ReallocShared(void* ptr, size_t size)
@@ -86,14 +86,14 @@ public:
        void *result;
        GetLockShared();
        result = m_pVMemShared->Realloc(ptr, size);
-       FreeLockShared()
+       FreeLockShared();
        return result;
     };
     inline void FreeShared(void* ptr)
     {
        GetLockShared();
        m_pVMemShared->Free(ptr);
-       FreeLockShared()
+       FreeLockShared();
     };
     inline void* CallocShared(size_t num, size_t size)
     {