Skip to content

Extra long code compilation whitch finished with "memory leak" report after ~20min #42937

Closed
@mixalbl4-127

Description

@mixalbl4-127

This issue started here: TypeStrong/fork-ts-checker-webpack-plugin#569

Current behavior

Make file: Api.ts

/* eslint-disable */
/* tslint:disable */
import { HttpClient } from "./http-client";

export class Api<SecurityDataType = unknown> {
  constructor(private http: HttpClient<SecurityDataType>) {}

    abc1 = () => this.http.request();
    abc2 = () => this.http.request();
    abc3 = () => this.http.request();
}

and http-client.ts

/* eslint-disable */
/* tslint:disable */

/** Overrided Promise type. Needs for additional typings of `.catch` callback */
type TPromise<ResolveType, RejectType = any> = Omit<Promise<ResolveType>, "then" | "catch"> & {
  then<TResult1 = ResolveType, TResult2 = never>(
    onfulfilled?: ((value: ResolveType) => TResult1 | PromiseLike<TResult1>) | undefined | null,
    onrejected?: ((reason: RejectType) => TResult2 | PromiseLike<TResult2>) | undefined | null,
  ): TPromise<TResult1 | TResult2, RejectType>;
  catch<TResult = never>(
    onrejected?: ((reason: RejectType) => TResult | PromiseLike<TResult>) | undefined | null,
  ): TPromise<ResolveType | TResult, RejectType>;
};

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
  data: D;
  error: E;
}

export class HttpClient<SecurityDataType = unknown> {
  public request = <T = any, E = any>(): TPromise<HttpResponse<T, E>> => {
    return '' as any;
  };
}

try to compile, you will see that "Issues checking in progress..." process take extra long time ~15 sec.
I dont know why, but if you Copy-Paste http-client.ts to Api.ts directly this check take <1 sec.

This files make this lib https://github.com/acacode/swagger-typescript-api with ~1000 this.http.request, and each this.http.request() took ~7 sec of checking. When I do this in intel i7 CPU, after ~30 min of compiling I got error about memory leak.

Video: https://user-images.githubusercontent.com/3511307/108701953-4a842480-7511-11eb-9924-7f3c0c60acd0.mp4

Environment

  • fork-ts-checker-webpack-plugin: 6.1.0
  • typescript: 3.9.9
  • eslint: 6.8.0
  • webpack: 4.46.0
  • os: Linux mint 18.3 KDE

Tested on latest typescript 4.2.2 - same result.

Same with tsc --watch --noEmit.

Video: https://user-images.githubusercontent.com/3511307/108986783-2eac8a00-769b-11eb-9f9e-27f914830c8d.mp4

Metadata

Metadata

Assignees

Labels

Domain: Declaration EmitThe issue relates to the emission of d.ts filesDomain: PerformanceReports of unusually slow behaviorFix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions