| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a64aa44 commit fd93622
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3227,11 +3227,7 @@ void Connection::Start(const FunctionCallbackInfo<Value>& args) { | |||
| 3227 | 3227 | void Connection::Close(const FunctionCallbackInfo<Value>& args) { | |
| 3228 | 3228 | Connection* conn; | |
| 3229 | 3229 | ASSIGN_OR_RETURN_UNWRAP(&conn, args.Holder()); | |
| 3230 | - | ||
| 3231 | - if (conn->ssl_ != nullptr) { | ||
| 3232 | - SSL_free(conn->ssl_); | ||
| 3233 | - conn->ssl_ = nullptr; | ||
| 3234 | - } | ||
| 3230 | + conn->DestroySSL(); | ||
| 3235 | 3231 | } | |
| 3236 | 3232 | ||
| 3237 | 3233 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,29 @@ | |||
| 1 | + // Flags: --expose-gc --no-deprecation | ||
| 2 | + 'use strict'; | ||
| 3 | + | ||
| 4 | + const common = require('../common'); | ||
| 5 | + const assert = require('assert'); | ||
| 6 | + | ||
| 7 | + if (!common.hasCrypto) { | ||
| 8 | + common.skip('missing crypto'); | ||
| 9 | + return; | ||
| 10 | + } | ||
| 11 | + | ||
| 12 | + const { createSecureContext } = require('tls'); | ||
| 13 | + const { createSecurePair } = require('_tls_legacy'); | ||
| 14 | + | ||
| 15 | + const before = process.memoryUsage().external; | ||
| 16 | + { | ||
| 17 | + const context = createSecureContext(); | ||
| 18 | + const options = {}; | ||
| 19 | + for (let i = 0; i < 1e4; i += 1) | ||
| 20 | + createSecurePair(context, false, false, false, options).destroy(); | ||
| 21 | + } | ||
| 22 | + global.gc(); | ||
| 23 | + const after = process.memoryUsage().external; | ||
| 24 | + | ||
| 25 | + // It's not an exact science but a SecurePair grows .external by about 45 kB. | ||
| 26 | + // Unless AdjustAmountOfExternalAllocatedMemory() is called on destruction, | ||
| 27 | + // 10,000 instances make it grow by well over 400 MB. Allow for some slop | ||
| 28 | + // because objects like buffers also affect the external limit. | ||
| 29 | + assert(after - before < 25 << 20); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments