Old 26th August 2008, 14:05   #1
blockcipher
Junior Member
 
Join Date: Aug 2008
Posts: 2
System::Alloc question

Does anyone know why System::Alloc would not allocate memory? I'm trying to allocate a small amount of memory, but for some reason it won't in the script I wrote. I tried the System.nsi sample script and it worked fine! As far as I can tell, I'm not really doing anything different, however I keep getting 0 back as the result.
blockcipher is offline   Reply With Quote
Old 26th August 2008, 17:57   #2
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Possible reasons are: The system is out of memory or the remaining memory is too much fragmented (that is: there is no continuous block of free memory of the requested size). Both sounds very unlikely in your case, because you say that you are requesting only a "small amount" of memory. So I guess you are doing something wrong. But it's hard to say without seeing your code...

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 26th August 2008, 20:42   #3
blockcipher
Junior Member
 
Join Date: Aug 2008
Posts: 2
Heh, yeah, that would help if I could post it. It's for a project at work, so I can't do that.

As for running out of memory, yeah, that's not happening. I tried this on a machine with 13Gb free and I'm only trying to allocate 4 bytes, which is the size of the value I'm trying to put into the buffer.

I do figure I'm doing something wrong, however I can't for the life of me figure it out. Every example I found revealed nothing of use. I mainly posted to see if anyone know of any sort of stack size limit/heap size limit/config setting/other that may have an affect on whether or not memory can be allocated.
blockcipher is offline   Reply With Quote
Old 26th August 2008, 21:06   #4
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Well, I tried this, just like the example:

code:
OutFile "TestAlloc.exe"

Section
System::Alloc 4
Pop $0
DetailPrint "4 bytes allocated at $0"
System::Free $0
SectionEnd



And the result seems to work fine:

code:
4 bytes allocated at 2247232
Completed



Something else must go wrong in your installer...

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR 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