-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flag "OPTIMIZE_MEMORY=true" to turn max_old_space_size on
[#143873083] Signed-off-by: Dave Goddard <dave@goddard.id.au>
- Loading branch information
1 parent
5962f63
commit fd5c9ee
Showing
11 changed files
with
41 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
#!/usr/bin/env bash | ||
# bin/release <build-dir> | ||
|
||
cat << EOF | ||
addons: [] | ||
default_process_types: | ||
web: npm start --max-old-space-size=$(( $(jq -r '.limits.mem' <<<"$VCAP_APPLICATION") * 75 / 100 )) $NPM_CLI_OPTIONS | ||
EOF | ||
|
||
echo 'addons: []' | ||
echo 'default_process_types:' | ||
|
||
if [[ "${OPTIMIZE_MEMORY:-}" = "true" ]]; then | ||
echo ' web: npm start --optimize_for_size --always_compact --max_old_space_size=$(( $(jq -r '.limits.mem' <<<"$VCAP_APPLICATION") * 75 / 100 ))' | ||
else | ||
echo ' web: npm start' | ||
fi |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
memory: 350MB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const http = require('http') | ||
const port = process.env.PORT || 8080 | ||
|
||
const requestHandler = (request, response) => { | ||
response.end(`MaxOldSpace: ${process.env.npm_config_max_old_space_size}`) | ||
} | ||
|
||
const server = http.createServer(requestHandler) | ||
|
||
server.listen(port, (err) => { | ||
if (err) { | ||
return console.log('something bad happened', err) | ||
} | ||
|
||
console.log(`server is listening on ${port}`) | ||
}) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters