-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Out of memory error when using ImmutableJS #17070
Comments
I'm not getting an out-of-memory error, but it is going very slow and I do get strange errors about using Map.merge with a Map argument, saying that it can't unify a Map<K,V> with a Collection<K,V>. 2.4.0 does not have these problems. |
As an fyi, setting the |
@sccolbert I've found a workaround for my OOM: #17097 (comment) |
immutable-js/immutable-js#1285 fixes or works around the out-of-memory crash as well as fixing new type errors by TS 2.4. However, my investigation didn't turn up any regressions in the compiler — just the same old explosion in assignability checking for mutually referential types. Here is a small standalone repro that I made: interface Funkadelic<T> { t: T }
interface Collection<K, V> {
//map<M>(mapper: (value: V, key: K, iter: this) => M): Collection<K, M>;
//flatMap<M>(mapper: (value: V, key: K, iter: this) => Funkadelic<M>, context?: any): Collection<K, M>;
// these seem necessary to push it over the top for memory usage
//reduce<R>(reducer: (reduction: R, value: V, key: K, iter: this) => R, initialReduction: R, context?: any): R;
//reduce<R>(reducer: (reduction: V | R, value: V, key: K, iter: this) => R): R;
toSeq(): Seq<K, V>;
}
interface Seq<K, V> extends Collection<K, V> {
}
interface N1<T> extends Collection<void, T> {
//map<M>(mapper: (value: T, key: void, iter: this) => M): N1<M>;
//flatMap<M>(mapper: (value: T, key: void, iter: this) => Funkadelic<M>, context?: any): N1<M>;
}
interface N2<T> extends N1<T> {
//map<M>(mapper: (value: T, key: void, iter: this) => M): N2<M>;
//flatMap<M>(mapper: (value: T, key: void, iter: this) => Funkadelic<M>, context?: any): N2<M>;
toSeq(): N2<T>;
} Notice that it doesn't even depend on Array or Iterable any more. The current version exhibits the bad behaviour but doesn't run out of memory. If you uncomment the other methods, then you'll get the out-of-memory crash. |
@sandersn You are right, I'm sorry. I only saw this linked #17097 (comment) and wrongfully thought that the workaround in immutable-js also involved changing type to interface. |
#17947 fixes this oomemory crash. The PR for immutable is still needed to fix the errors uncovered by 2.4, except for the |
Simply importing the type definitions of ImmutableJS is enough to crash the compiler with an out of memory exception.
TypeScript Version: 2.4.1
index.ts
package.json
tsconfig.json
Expected behavior:
npm run build
should execute cleanly.Actual behavior:
Out of memory error:
The text was updated successfully, but these errors were encountered: