Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Memory hole? (http://forums.winamp.com/showthread.php?t=164755)

spanky 14th January 2004 00:03

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
-------------------------

rainwater 14th January 2004 00:22

Unless its leaking memory, I don't see a bug since its an infinite loop.

spanky 14th January 2004 01:08

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?!

Joel 14th January 2004 19:19

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.

spanky 14th January 2004 23:41

so why is it gobbling up memory and how can it be freed?

Joel 15th January 2004 00:10

mmm, because there's no exit for the loop.

spanky 15th January 2004 04:29

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.

Yathosho 15th January 2004 11:32

that's how IE works, and i think not NSIS is to blame for this ;)

Joost Verburg 15th January 2004 11:43

NSISdl does not use IE.

Joel 15th January 2004 19:47

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.

spanky 15th January 2004 22:34

ah, so the usage is keeping track of where it is in the loop?

Koen van de Sande 16th January 2004 15:04

Yes :)

kichik 16th January 2004 16:44

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.

spanky 17th January 2004 00:19

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?

Joel 17th January 2004 03:58

It's not a NSIS bug. It's the computer working out with an endless loop.

Joost Verburg 17th January 2004 10:40

It is a bug in the NSISdl plug-in.

kichik 17th January 2004 16:42

Lobo, try:

loop:
sleep 1
goto loop

Joel 17th January 2004 18:15

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...

Joost Verburg 17th January 2004 21:35

Indeed. So there is something wrong with NSISdl.

Koen van de Sande 18th January 2004 11:39

I stand corrected then. I thought an infinite loop would start eating up the stack, but I guess it doesn't.

kichik 1st February 2004 17:56

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.


All times are GMT. The time now is 17:48.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.