nwjs / nw.js

Call all Node.js modules directly from DOM/WebWorker and enable a new way of writing applications with all Web technologies.
https://nwjs.io
MIT License
40.35k stars 3.88k forks source link

memory leak when loading png ( or image files? ) in general #4178

Closed hems closed 6 years ago

hems commented 8 years ago

I have 20 Image() objects which i keep re-using to reload different images randomly, i can see the memory increasing even if i set the "src" attribute to "" ( empty ).

i tried calling gc(), but it doesn't work in this case.

it renders my application unusable after some time //=

tested on nw.js v0.12.3 OSX

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

rogerwang commented 8 years ago

Does it work for you with the latest 0.13 beta version? http://dl.nwjs.io/live-build/01-07-2016/

hems commented 8 years ago

@rogerwang i have 3rd party modules compiled to work with 0.12.3 so i need sometime to try it out, will try to test it now.

hems commented 8 years ago

when trying to run nwjs-v0.13.0-beta2 i get the following error:

final/application [ ./resources/node-webkit/nwjs-v0.13.0-beta2-osx-x64/nwjs.app/Contents/MacOS/nwjs app
[0107/060846:INFO:nw_package.cc(175)] ./resources/node-webkit/nwjs-v0.13.0-beta2-osx-x64/nwjs.app/Contents/MacOS/nwjs app
[16743:1299:0107/060847:ERROR:command_buffer_proxy_impl.cc(196)] Could not send GpuCommandBufferMsg_Initialize.
[16743:1299:0107/060847:ERROR:webgraphicscontext3d_command_buffer_impl.cc(208)] CommandBufferProxy::Initialize failed.
[16743:1299:0107/060847:ERROR:webgraphicscontext3d_command_buffer_impl.cc(227)] Failed to initialize command buffer.
hems commented 8 years ago

that only happens if i keep "show" as "false" by default on my package.json

hems commented 8 years ago

i'm failing to compile sqlite3, i tried:

npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=x64 --target=0.13.0

and now

npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=x64 --target=0.13.0-beta

but none of them worked /=

and none of them worked

rogerwang commented 8 years ago

Extracting a case from your app would help. btw, the version string should be 0.13.0-beta2 at least.

hems commented 8 years ago

i might have just done something wrong with my NVM while swapping versions in different zsh tabs.

i'm doing it all again, wait a sec.

hems commented 8 years ago

@rogerwang compiling sqlite3 with 0.13.0-beta2 worked ( will see if the app works now )

hems commented 8 years ago

my app opens, but freezes

hems commented 8 years ago

simple hello works, but if i do

  gui = require( "nw.gui")
  gui.Window.get().showDevTools()

then i get this on the console:

2016-01-07 06:39:48.422 nwjs[20435:2114839] NSWindow warning: adding an unknown subview: <TabStripBackgroundView: 0x7fb02a63aaa0>
2016-01-07 06:39:48.424 nwjs[20435:2114839] Call stack:
(
    0   AppKit                              0x00007fff8d54aa9c -[NSThemeFrame addSubview:] + 107
    1   AppKit                              0x00007fff8cf39a3f -[NSView addSubview:positioned:relativeTo:] + 208
    2   nwjs Framework                      0x00000001039529db _ZN2v88UnlockerD1Ev + 21047291
    3   nwjs Framework                      0x00000001038a3cec _ZN2v88UnlockerD1Ev + 20331276
    4   nwjs Framework                      0x00000001038adf92 _ZN2v88UnlockerD1Ev + 20372914
    5   nwjs Framework                      0x00000001039b4810 _ZN2v88UnlockerD1Ev + 21448240
    6   nwjs Framework                      0x0000000100ddfdc8 ChromeMain + 4497672
    7   nwjs Framework                      0x0000000100ddf790 ChromeMain + 4496080
    8   nwjs Framework                      0x0000000100ddf002 ChromeMain + 4494146
    9   nwjs Framework                      0x0000000100ddedd6 ChromeMain + 4493590
    10  nwjs Framework                      0x0000000104de8262 _ZN2v88UnlockerD1Ev + 42631298
    11  nwjs Framework                      0x0000000104397fe1 _ZN2v88UnlockerD1Ev + 31817217
    12  nwjs Framework                      0x0000000104399cfe _ZN2v88UnlockerD1Ev + 31824670
    13  nwjs Framework                      0x0000000104399fc3 _ZN2v88UnlockerD1Ev + 31825379
    14  nwjs Framework                      0x00000001043b5cb2 _ZN2v88UnlockerD1Ev + 31939282
    15  nwjs Framework                      0x00000001045cebbf _ZN2v88UnlockerD1Ev + 34138591
    16  nwjs Framework                      0x0000000103ebec18 _ZN2v88UnlockerD1Ev + 26733112
    17  nwjs Framework                      0x0000000103c9d842 _ZN2v88UnlockerD1Ev + 24499810
    18  nwjs Framework                      0x0000000103de0a8e _ZN2v88UnlockerD1Ev + 25823406
    19  nwjs Framework                      0x0000000101956208 ChromeMain + 16516424
    20  nwjs Framework                      0x0000000100edf4da ChromeMain + 5543962
    21  nwjs Framework                      0x0000000100f007f9 ChromeMain + 5679929
    22  nwjs Framework                      0x0000000100f00aee ChromeMain + 5680686
    23  nwjs Framework                      0x0000000100f00cec ChromeMain + 5681196
    24  nwjs Framework                      0x0000000100ed3dd1 ChromeMain + 5497105
    25  nwjs Framework                      0x0000000100ef738a ChromeMain + 5641930
    26  nwjs Framework                      0x0000000100ed37d4 ChromeMain + 5495572
    27  CoreFoundation                      0x00007fff90458661 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    28  CoreFoundation                      0x00007fff9044a7ed __CFRunLoopDoSources0 + 269
    29  CoreFoundation                      0x00007fff90449e1f __CFRunLoopRun + 927
    30  CoreFoundation                      0x00007fff90449838 CFRunLoopRunSpecific + 296
    31  HIToolbox                           0x00007fff85bd243f RunCurrentEventLoopInMode + 235
    32  HIToolbox                           0x00007fff85bd21ba ReceiveNextEventCommon + 431
    33  HIToolbox                           0x00007fff85bd1ffb _BlockUntilNextEventMatchingListInModeWithFilter + 71
    34  AppKit                              0x00007fff8ce896d1 _DPSNextEvent + 964
    35  AppKit                              0x00007fff8ce88e80 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 194
    36  AppKit                              0x00007fff8ce7ce23 -[NSApplication run] + 594
    37  nwjs Framework                      0x0000000100ed4521 ChromeMain + 5498977
    38  nwjs Framework                      0x0000000100ed3c24 ChromeMain + 5496676
    39  nwjs Framework                      0x0000000100f16173 ChromeMain + 5768371
    40  nwjs Framework                      0x0000000100a2c51f ChromeMain + 616543
    41  nwjs Framework                      0x0000000103beb7a9 _ZN2v88UnlockerD1Ev + 23770569
    42  nwjs Framework                      0x0000000103bedd12 _ZN2v88UnlockerD1Ev + 23780146
    43  nwjs Framework                      0x0000000103be7847 _ZN2v88UnlockerD1Ev + 23754343
    44  nwjs Framework                      0x0000000100e90848 ChromeMain + 5221256
    45  nwjs Framework                      0x0000000100e8fe56 ChromeMain + 5218710
    46  nwjs Framework                      0x0000000100995d02 ChromeMain + 66
    47  nwjs                                0x000000010098cf39 main + 9
    48  nwjs                                0x000000010098cf24 nwjs + 3876
)
[20435:1811:0107/063948:ERROR:CONSOLE(1)] "Uncaught ReferenceError: DevToolsAPI is not defined", source:  (1)
hems commented 8 years ago

it seems i have some problems on my app due to the migration, but i can't see the errors because devtools don't open.

hems commented 8 years ago

will try the NACL version now

hems commented 8 years ago

save dev tools problem

hems commented 8 years ago

when i try remote-debugging i can see my two windows on it, but when i click them the whole page turns white and i can't debug //=

Christywl commented 7 years ago

@hems , is this issue still reproduced on the latest nwjs build? If so, could you please upload a sample? Btw, for https://github.com/nwjs/nw.js/issues/4178#issuecomment-169568643, the devtools works well for me on Mac with nwjs-sdk-v0.22.1, and I don't see those errors in the console.

hems commented 7 years ago

It turns out updating to newest nwjs created other problems in my project which was already "delivered" so i couldn't carry on this issue, it seems it might needs an update soon so i might get adventurous and try to sort this out.

I also need to solve this issue: https://github.com/nwjs/nw.js/issues/5256 but still didn't find an "official" solution for it, so that might be a good test

Christywl commented 7 years ago

Could you please share your sample and steps for me? I can help to check it with the latest nwjs build.

hems commented 7 years ago

@Christywl i don't have an example now, but i was simply changing the "src" property of an tag dynamically and i could see the memory would keep increase forever as i keep changing the images as if no image was disposed from memory.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.