Old 14th January 2004, 00:03   #1
spanky
Senior Member
 
Join Date: May 2000
Posts: 295
Send a message via ICQ to spanky
Unhappy Memory hole?

I'm not sure why but this example below will use upwards towards 90MB of memory within 20 mins. In my test I pointed the download file to something small, around 20K in size.
I've tested this bug(?) with various builds, including the latest CVS release.


-------------------------
Name "memoryhole"
OutFile "memoryhole.exe"
Caption "memoryhole"
SilentInstall silent

Section ""

foo:
NSISdl::download http://www.noname.com/poo.jpg $EXEDIR\outfile.exe
sleep 25
goto foo

SectionEnd
-------------------------

all work and no play makes jack a dull boy
spanky is offline   Reply With Quote
Old 14th January 2004, 00:22   #2
rainwater
Senior Member
 
Join Date: Aug 2000
Posts: 397
Send a message via ICQ to rainwater
Unless its leaking memory, I don't see a bug since its an infinite loop.
rainwater is offline   Reply With Quote
Old 14th January 2004, 01:08   #3
spanky
Senior Member
 
Join Date: May 2000
Posts: 295
Send a message via ICQ to spanky
Quote:
Originally posted by rainwater
Unless its leaking memory, I don't see a bug since its an infinite loop.
It uses more and more memory with each loop. That is a memory leak, is it not?!

all work and no play makes jack a dull boy
spanky is offline   Reply With Quote
Old 14th January 2004, 19:19   #4
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
No, is not. Like rainwater said, you only have an endless loop, but it'll grab memory.
Leak is when you don't empty the space in the memory. In this case you just loading up.


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 14th January 2004, 23:41   #5
spanky
Senior Member
 
Join Date: May 2000
Posts: 295
Send a message via ICQ to spanky
so why is it gobbling up memory and how can it be freed?

all work and no play makes jack a dull boy
spanky is offline   Reply With Quote
Old 15th January 2004, 00:10   #6
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
mmm, because there's no exit for the loop.


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 15th January 2004, 04:29   #7
spanky
Senior Member
 
Join Date: May 2000
Posts: 295
Send a message via ICQ to spanky
what you say makes no sense. I don't see why having "no exit for the loop" is a reason for this example to gobble 90MB+ in less than 20 mins.

all work and no play makes jack a dull boy
spanky is offline   Reply With Quote
Old 15th January 2004, 11:32   #8
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
that's how IE works, and i think not NSIS is to blame for this
Yathosho is offline   Reply With Quote
Old 15th January 2004, 11:43   #9
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
NSISdl does not use IE.
Joost Verburg is offline   Reply With Quote
Old 15th January 2004, 19:47   #10
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
Quote:
Originally posted by spanky
what you say makes no sense. I don't see why having "no exit for the loop" is a reason for this example to gobble 90MB+ in less than 20 mins.
It's memory "usage", no leaking, of the Win32 APIs. Since there's no stop in the loop, the OS (Windows) works endless.


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 15th January 2004, 22:34   #11
spanky
Senior Member
 
Join Date: May 2000
Posts: 295
Send a message via ICQ to spanky
ah, so the usage is keeping track of where it is in the loop?

all work and no play makes jack a dull boy
spanky is offline   Reply With Quote
Old 16th January 2004, 15:04   #12
Koen van de Sande
Senior Member
 
Join Date: Mar 2001
Location: Holland
Posts: 269
Yes

Koen van de Sande
Van de Sande Productions
TibEd.net | VPatch
Koen van de Sande is offline   Reply With Quote
Old 16th January 2004, 16:44   #13
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
No, that's not supposed to happen. No API call should increase memory usage when used in a loop assuming its freeing function is also called in the loop.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 17th January 2004, 00:19   #14
spanky
Senior Member
 
Join Date: May 2000
Posts: 295
Send a message via ICQ to spanky
Quote:
Originally posted by kichik
No, that's not supposed to happen. No API call should increase memory usage when used in a loop assuming its freeing function is also called in the loop.
so would this mean there is a bug in NSIS?

all work and no play makes jack a dull boy
spanky is offline   Reply With Quote
Old 17th January 2004, 03:58   #15
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
It's not a NSIS bug. It's the computer working out with an endless loop.


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 17th January 2004, 10:40   #16
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
It is a bug in the NSISdl plug-in.
Joost Verburg is offline   Reply With Quote
Old 17th January 2004, 16:42   #17
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Lobo, try:

loop:
sleep 1
goto loop

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 17th January 2004, 18:15   #18
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
code:

Name "memoryleak"
OutFile "memoryleak.exe"
Caption "memoryleak"
SilentInstall silent

Section ""
Loop:
sleep 1
goto Loop
SectionEnd


The memory usage of the EXE still 2,188 KB. No overflow of the memory...


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 17th January 2004, 21:35   #19
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
Indeed. So there is something wrong with NSISdl.
Joost Verburg is offline   Reply With Quote
Old 18th January 2004, 11:39   #20
Koen van de Sande
Senior Member
 
Join Date: Mar 2001
Location: Holland
Posts: 269
I stand corrected then. I thought an infinite loop would start eating up the stack, but I guess it doesn't.

Koen van de Sande
Van de Sande Productions
TibEd.net | VPatch
Koen van de Sande is offline   Reply With Quote
Old 1st February 2004, 17:56   #21
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
The main leak is in your code. You forgot to Pop the returned value. This leaks 1KB each iteration of the loop. Other than that, there were some problems with NSISdl. Hopefully they were all fixed in the latest CVS version. See the change log for more details.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump