Overview
| Artifact ID: | d363114314e6ade44de6083843a30c9978cf3f1f |
|---|---|
| Ticket: | 582256ffffffffffffffffffffffffffffffffff
Releasing Tcl_Obj Allocator |
| User & Date: | georgeps on 2006-01-07 15:14:50 |
Changes
- icomment:
Logged In: YES user_id=585068 This patch will break on some platforms. It assumes that a long can store a pointer value, which is usually true, but isn't required. IIRC Win64 just has 64-bit pointers, and keeps long as a 32-bit type. I also note that you're just supporting mmap. VirtualAlloc can be used in Windows to accomplish the same thing. Specifically this code: PoolBookkeeping *pagePtr = (PoolBookkeeping *) (((long)objPtr) & POOL_ADDR_MASK); This code clearly seems wrong: if (devzero == -123456) { + /* + * This leaks a file-descriptor, but there's no neat way to + * avoid it without opening and closing each time, which is + * desperately inefficient. + */ + devzero = TclOSOpen("/dev/zero", O_RDONLY); + } + if (devzero<0) { + return NULL; + } How much of an impact is it to close and reopen /dev/zero? Have you compared the cost to a memset (gcc builtin)? This code scares me a bit: +# ifndef MAP_FAILED +# define MAP_FAILED ((VOID *)-1) +# endif What platforms lack MAP_FAILED? Can we safely assume that -1 is the right value on such a platform? - login: "georgeps"
- mimetype: "text/plain"
- username: "georgeps"