A component that uses the "bsDatepicker" will be hold in memory despite being destroyed.
angular. 5.2.9
ngx-bootstrap: 2.0.4
reproduce:
<input type="text" placeholder="Datepicker" class="form-control" bsDatepicker>result:
multiple instances of the 2nd component resist in memory, despite they have been destroyed

ngx-bootstrap: 2.0.5
Angular: 5.x
We had also a memory leak issue due to bsDatePicker which prevents the angular component to be garbage-collected.
Our workaround has been to comment the following code in the file bs-datepicker-input.directive.js:
// update input value on locale change
// this._localeService.localeChange.subscribe(function () {
// _this._setInputValue(_this._value);
// });
I hope that it would be useful for you.
ngx-bootstrap: 5
Angular: 7
It seems the problem still exists.
Here is a small example: https://stackblitz.com/edit/angular-n4tusz
Simply route back and forth between the components and create snapshots e.g. with the Chrome DevTools to examine the objects in the memory.


After the datepicker component has been opened several times:

Hi, I'm working with an application with dozens of datepickers, and this issue may cause the parent component to be retained. Of course, the memory builds up massively.
This issue has been open a while - so I'm wondering: are you not wanting to fix it as it is not regarded an issue, or simply hasn't been looked at? Happy to provide a fix if welcome :)
Created a Pull Request https://github.com/valor-software/ngx-bootstrap/pull/5521
Hi, any news on this? Can we expect the fix from @Gbuomprisco to be merged any time soon? We are affected by this issue as well.
Hi, this memory leak is quite intense. For comparison screenshot on memory consumption chart with untouched sources and sources with localeService subscription commented out. As you can see on the first chart the memory consumption is still increasing. On second chart, after garbage collection it has the same size as at the beginning.
Original:

Without localeService subscription:

Most helpful comment
Created a Pull Request https://github.com/valor-software/ngx-bootstrap/pull/5521