Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
Update comments to be more accurate
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis-Ye committed Jun 14, 2021
1 parent f324630 commit 043474d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/agent/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ export interface ResolvedDebugAgentConfig extends GoogleAuthOptions {
apiUrl?: string;

/**
* Number of times of the V8 pause events (could be breakpoint hits) before
* resetting the breakpoints. This is to release the memory usage held by V8
* Number of times the V8 pauses (could be breakpoint hits) before the
* debugging session is reset. This is to release the memory usage held by V8
* engine for each breakpoint hit to prevent the memory leak. The default
* value is specified in defaultConfig.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/agent/v8/inspector-debugapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class InspectorDebugApi implements debugapi.DebugApi {
this.fileStats = jsFiles;
this.sourcemapper = sourcemapper;
this.inspector = new V8Inspector(
/* useWellFormattedUrl=*/ logger,
/* logger=*/ logger,
/*useWellFormattedUrl=*/ utils.satisfies(process.version, '>10.11.0'),
/*resetV8DebuggerThreshold=*/ this.config.resetV8DebuggerThreshold,
/*onScriptParsed=*/
Expand Down
15 changes: 9 additions & 6 deletions src/agent/v8/v8inspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,16 @@ export class V8Inspector {
session.post('Debugger.setBreakpointsActive', {active: true});
session.on('Debugger.paused', message => {
this.onPaused(message.params);
this.resetV8DebuggerIfMeetThreshold();
this.resetV8DebuggerIfThresholdMet();
});

this.session = session;
}

/** Detaches from the V8 debugger. */
/**
* Detaches from the V8 debugger. This will purge all the existing V8
* breakpoints from the V8 debugger.
*/
detach() {
if (!this.session) {
return;
Expand All @@ -177,11 +180,11 @@ export class V8Inspector {
}

/**
* Resets the debugging session when the threshold. This is primarily for
* cleaning the memory usage hold by V8 debugger when hitting the V8
* breakpoints too many times.
* Resets the debugging session when the number of paused events meets the
* threshold. This is primarily for cleaning the memory usage hold by V8
* debugger when hitting the V8 breakpoints too many times.
*/
private resetV8DebuggerIfMeetThreshold() {
private resetV8DebuggerIfThresholdMet() {
this.numPausedBeforeReset += 1;
if (this.numPausedBeforeReset < this.resetV8DebuggerThreshold) {
return;
Expand Down

0 comments on commit 043474d

Please sign in to comment.