Skip to content

Commit

Permalink
erts: Only use limits when defined
Browse files Browse the repository at this point in the history
  • Loading branch information
psyeugenic committed Jan 16, 2012
1 parent a99093a commit 75d45d2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion erts/emulator/beam/erl_gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,8 @@ erts_garbage_collect(Process* p, int need, Eterm* objv, int nobj)
p->last_old_htop = p->old_htop;
#endif

if ((HEAP_SIZE(p) + (OLD_HEAP(p) ? (OLD_HEND(p) - OLD_HEAP(p)) : 0)) > LIMIT_HEAP_SIZE(p)) {
if (ERTS_PROC_HAS_HEAP_SIZE_LIMIT(p) &&
(HEAP_SIZE(p) + (OLD_HEAP(p) ? (OLD_HEND(p) - OLD_HEAP(p)) : 0)) > LIMIT_HEAP_SIZE(p)) {
if (IS_TRACED_FL(p, F_TRACE_GC)) {
trace_gc(p, am_system_limit);
}
Expand Down
4 changes: 2 additions & 2 deletions erts/emulator/beam/erl_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ erl_start(int argc, char **argv)
VERBOSE(DEBUG_SYSTEM, ("using minimum heap size %d\n", H_MIN_SIZE));
} else if (has_prefix("ls", sub_param)) {
arg = get_arg(sub_param+2, argv[i+1], &i);
if ((H_MAX_SIZE = atoi(arg)) <= 0) {
if ((H_MAX_SIZE = atoi(arg)) < 0) {
erts_fprintf(stderr, "bad heap size %s\n", arg);
erts_usage();
}
Expand Down Expand Up @@ -1450,7 +1450,7 @@ erl_start(int argc, char **argv)
}

/* make sure min heap size is less than max heap size */
if (H_MAX_SIZE <= H_MIN_SIZE) {
if (H_MAX_SIZE && H_MAX_SIZE <= H_MIN_SIZE) {
erts_fprintf(stderr, "bad heap size, min heap %d >= max heap %d\n", H_MIN_SIZE, H_MAX_SIZE);
erts_usage();
}
Expand Down
8 changes: 5 additions & 3 deletions erts/emulator/beam/erl_process.h
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,11 @@ typedef struct {
} while (0)
#endif

/* Define easy access to process limits */
#define LIMIT_HEAP_SIZE(p) (p)->limits.heap_size
#define ERTS_PROC_HAS_HEAP_SIZE_LIMIT(p) ((p)->limits.heap_size > 0)


/*
* Process Specific Data.
*
Expand Down Expand Up @@ -611,9 +616,6 @@ struct ErtsPendingSuspend_ {
# define BIN_OLD_VHEAP_SZ(p) (p)->bin_old_vheap_sz
# define BIN_OLD_VHEAP(p) (p)->bin_old_vheap

/* Define easy access to process limits */
# define LIMIT_HEAP_SIZE(p) (p)->limits.heap_size

struct process {
/* All fields in the PCB that differs between different heap
* architectures, have been moved to the end of this struct to
Expand Down
2 changes: 1 addition & 1 deletion erts/emulator/beam/erl_vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
#define INPUT_REDUCTIONS (2 * CONTEXT_REDS)

#define H_DEFAULT_SIZE 233 /* default (heap + stack) min size */
#define H_DEFAULT_LIMIT_SIZE 536870902 /* default (heap + stack) min size */
#define H_DEFAULT_LIMIT_SIZE 0 /* default (heap + stack) max size, 0 = off */
#define VH_DEFAULT_SIZE 32768 /* default virtual (bin) heap min size (words) */

#ifdef HYBRID
Expand Down

0 comments on commit 75d45d2

Please sign in to comment.