The program threads-memory.c (included below) starts 100 threads, allocates 1
MB of memory in each, and then pauses. How much memory is it using?
Let's find out by running it:
$ gcc -pthread threads-memory.c -o threads-memory
| #!/usr/bin/env bash | |
| # Checked with ShellCheck (https://www.shellcheck.net/) | |
| # Shell setup | |
| # =========== | |
| # Bash options for strict error checking. | |
| set -o errexit -o errtrace -o pipefail -o nounset | |
| shopt -s inherit_errexit 2>/dev/null || true |
| # Run as root or add `sudo` where needed. | |
| # General tools. | |
| apt-get update | |
| apt-get install --no-install-recommends git ca-certificates build-essential devscripts dpkg-dev | |
| # openh264 | |
| { | |
| git clone --branch 7.0.0 https://github.com/Kurento/openh264.git | |
| cd openh264 |
| // Replacer function meant for `JSON.stringify()`. | |
| function getCircularReplacer() { | |
| const seen = new WeakSet(); | |
| return (_key, value) => { | |
| // Non-null "object" properties: return a deep copy without circular references. | |
| if (typeof value === "object" && value !== null) { | |
| // Remove circular references. | |
| if (seen.has(value)) { | |
| // Option 1: Replace circular references with a string. | |
| return "(circular)"; |
| /** | |
| * Prints the path to all values whose names match the given regular expression. | |
| * | |
| * @param {Object} input - An object that contains the parent from where to | |
| * start searching recursively for all key names. | |
| * | |
| * The input object can be passed with just an standalone value, which then | |
| * will be used itself as the prefix for the result. | |
| * | |
| * For example, for a parent object `root` which contains a hierarchy of |
| #!/bin/bash | |
| # Step 1: Obtain a list of our personal hosts. | |
| # Export from Bitwarden, LastPass, 1Password, or similar: | |
| my_passwords.txt | |
| # Next commands will assume the LastPass export format, which is CSV with the URL in the first field: | |
| # url,username,password,[... more fields] |
| # Run command: | |
| # | |
| # $ python3 HttpPostServer.py | |
| # | |
| # Test POST with a complete file: | |
| # | |
| # $ curl --data-binary "@small_file.bin" "http://127.0.0.1:8080/small.bin" | |
| # | |
| # Test POSTing a file progressively (chunked mode): | |
| # |
References:
Github offers 3 options when merging:
| v=0 | |
| o=- 4920969914039852086 2 IN IP4 127.0.0.1 | |
| s=- | |
| t=0 0 | |
| a=group:BUNDLE 0 1 | |
| a=msid-semantic: WMS 90c21009-8d9f-4b31-8091-d98deb8361c8 | |
| m=audio 61842 UDP/TLS/RTP/SAVPF 111 103 9 102 0 8 105 13 110 113 126 | |
| c=IN IP4 192.168.1.105 | |
| a=rtcp:9 IN IP4 0.0.0.0 | |
| a=candidate:2222700650 1 udp 2113937151 192.168.1.105 61842 typ host generation 0 network-cost 999 |
| v=0 | |
| o=mozilla...THIS_IS_SDPARTA-79.0 1574413241511582424 0 IN IP4 0.0.0.0 | |
| s=- | |
| t=0 0 | |
| a=sendrecv | |
| a=fingerprint:sha-256 43:63:A0:1A:D4:F3:6A:0B:B9:DC:AD:8B:A4:20:22:17:B9:BD:FC:81:9F:EC:E9:46:E0:61:3B:8B:2A:05:9A:D9 | |
| a=group:BUNDLE 0 1 | |
| a=ice-options:trickle | |
| a=msid-semantic:WMS * | |
| m=audio 9 UDP/TLS/RTP/SAVPF 109 9 0 8 101 |