Request for Review: 5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion (original) (raw)
Martin Buchholz martinrb at google.com
Thu Dec 20 04:32:45 UTC 2012
- Previous message: Request for Review: 5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
- Next message: Request for Review: 5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- res = readFully (fdin, &magic, sizeof(magic));
- if (res != 4 || magic != magicNumber()) {
s/4/sizeof(magic)/
+extern int errno;
Delete.
+#define ALLOC(X,Y) { \
- void *mptr; \
- mptr = malloc (Y); \
- if (mptr == 0) { \
error (fdout, ERR_MALLOC); \
- } \
- X = mptr; \
+}
It's traditional to define such a thing as a real function instead of a macro, often with the name xmalloc.
Compare with
static void* xmalloc(JNIEnv *env, size_t size) { void *p = malloc(size); if (p == NULL) JNU_ThrowOutOfMemoryError(env, NULL); return p; }
#define NEW(type, n) ((type *) xmalloc(env, (n) * sizeof(type)))
- Previous message: Request for Review: 5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
- Next message: Request for Review: 5049299: (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]