Results 1 to 8 of 8

Thread: Out of Stack Space Error 28

  1. #1

    Thread Starter
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Out of Stack Space Error 28

    Hi guys.

    I've been using the Martins VB - A Program Registration Scheme for a while and it works ok.

    The problem is its all numbers e.g. -0074612515 I want to make it alphanumeric.

    #178

    As that link says there is a good app on PSC Unique Serial Number Protection **UPDATED AGAIN - Version 1.5**

    This uses multiple textboxes to show different ways to show the code. I've taken out the parts that I want and the app works and compiles. Now when I've tried it recently its giving an Out of Stack Space Error 28.

    https://msdn.microsoft.com/en-us/lib...(v=vs.60).aspx

    I haven't changed the code much. There are only 2 functions Invert and iSplit from the PSC app along with a dozen variables, all declared.

    I've looked at Monitoring the Call Stack

    That says From the View menu, choose Call Stack, there is no Call Stack in the View menu. I've run Debug mode but that doesn't help.

    How can I get rid of this Out of Stack Space Error 28?

    The main purpose of this app is for a Keygen for another app that checks the hard drive serial number against the serial number they enter in. If valid they have access to all the database, it not they can only see 2000 items. As I've said the PSC app uses multiple textboxes to show different codes. In the main app I want to use a function that checks the serial number is valid. I would have to make an array of what's in the textboxes.
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Out of Stack Space Error 28

    How can I get rid of this Out of Stack Space Error 28?
    Install more stack space? Stop using so much stack?

    How the heck should we know? You're not a noob, so you're not getting any slack from me... not even any stack either ... you know better than to post about what's wrong and not supply the code in question...

    99% of the time there's an out of stack error it's because something is recursive and didn't provide an exit condition, or it gets cause in an infinite loop where sub1 calls sub2 calls sub3 calls sub4 calls event which triggers sub1, repeat ad nauseum.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,915

    Re: Out of Stack Space Error 28

    Yeah, techgnome's answer almost has to be correct. That's what I was thinking even before I read his reply.

    Runaway recursion is clearly the fastest way to gobble up all of your stack.

    Another way is an incorrectly declared API call, but that's more likely to just cause a GPF hang, rather than out-of-stack-space. But it's something to check.

    Also, there are ways to do recursion other than a procedure (somewhere down the line) calling itself. I'd have to research to be sure, but things like Mid() on left-side and/or possibly Replace() may get into recursive situations. I'm always careful to avoid those, but I know they exist.

    Regards,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  4. #4

    Thread Starter
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Re: Out of Stack Space Error 28

    Thanks for the comments guys.

    I've been using VB for the past 20 years and that's the first time I've had the Out of Stack Space Error 28 error.

    I've had an app with 80 Forms and hundreds of variables and that ran ok and compiled.

    The only API I use is:

    Code:
    Private Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal pVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
    To get the hard drive serial number.

    I could post my app if its needed.
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

  5. #5
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Out of Stack Space Error 28

    That does not get the hard drive serial number, only the volume serial number which is a soft value a user can change fairly easily. It isn't a secure thing to use to fingerprint a PC for license enforcement, though it might be good enough for your purposes.

    Getting actual drive serial numbers is a far more complex process.

    The most common cause of stack overflows in VB is the use of the DoEvents() function. Usually it occurs when you have controls that can raise events based on "external stimuli" for example MSComm and Winsock. But DoEvents() is always evil in this way and should be avoided at all costs. When you must use it you have to disable all controls that could raise an event, but controls like Winsock can't be disabled.

  6. #6
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,915

    Re: Out of Stack Space Error 28

    Keithuk,

    My main application has over 200 forms on it. It doesn't sound like the number of forms or the number of variables is the problem.

    Can't you get the line of code that's crashing???

    For instance, I started a new project, and then put the following code into the Form1:

    Code:
    
    Option Explicit
    
    Private Sub Form_Load()
        Call InfiniteRecursion
    End Sub
    
    
    Private Sub InfiniteRecursion()
        InfiniteRecursion
    End Sub
    

    And then I ran it, and got:

    Name:  nostack.gif
Views: 2002
Size:  6.3 KB

    And then I click "Debug" and get:

    Name:  NoStack2.gif
Views: 1889
Size:  11.5 KB

    You should be able to show us something similar. If you want to zip and post your project, I'll take a look, but I'd rather stare at snippets of your code.

    Regards,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  7. #7

    Thread Starter
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Re: Out of Stack Space Error 28

    Ok Elroy that code gives Out of Stack Space Error 28. What does InfiniteRecursion do as its not a VB function?

    The Debug window is a bit of a pain as you can't select anything once the error occurs.

    When you run this app you copy and paste the hard drive number in a textbox then click a button which txtHDDSN.Text = txtHDDSN.Text * -1, which removed the negative.

    Then you click another button Generate Unique Request Code (SN + PID) this adds another 24 numbers to the hard drive number. The you click Alpha Replacement Sequence button to find the alphanumeric number of the new Generate Unique Request Code (SN + PID).

    As I've said the original PSC codes has multiple textboxes Text3 to Text17 to show different parts of the code. Some shuffled, some reversed. I put all the alpha textboxes Text13 to Text17 separated by - to show all numbers together in a txtFullAlpha textbox.

    I didn't really want to click different buttons I wanted to copy and paste the drive number you want the alphanumeric number for so I added cmdAlpha_Click under the HDDSN button. I REM this out and it works without the Out of Stack Space Error 28.

    As I've said if you want to check out Unique Serial Number Protection **UPDATED AGAIN - Version 1.5**
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

  8. #8
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,915

    Re: Out of Stack Space Error 28

    Hi Keithuk,

    Quote Originally Posted by Keithuk View Post
    What does InfiniteRecursion do as its not a VB function?
    InfiniteRecursion is the Sub procedure that you see. It's calling itself, endlessly. That's the simplest form of recursion (a procedure calling itself). What happens is, it pushes the return address on the stack, and then executes. However, since it's recursing, it again pushes its return address on the stack over and over and OVER until stack space runs out. That's just the easiest way to show an "Out Of Stack Space" error.

    Quote Originally Posted by Keithuk View Post
    The Debug window is a bit of a pain as you can't select anything once the error occurs.
    I wasn't really talking about the Debug (Immediate) Window. I was talking about clicking the Debug button once the error occurs. When you do this, the IDE should show you the exact line of code that caused the error. Knowing what line it is (and some of the surrounding code) typically identifies the precise cause of the error. Also, when in this Stop/Debug mode, you can still hover over variables and get their values.

    Quote Originally Posted by Keithuk View Post
    txtHDDSN.Text = txtHDDSN.Text * -1, which removed the negative.
    A much better way to remove the negative would be: txtHDDSN.Text = Abs(txtHDDSN.Text). Your code will actually make an initially positive number negative.

    Quote Originally Posted by Keithuk View Post
    As I've said if you want to check out Unique Serial Number Protection **UPDATED AGAIN - Version 1.5**
    I'm not really up for downloading that project, especially since I don't know exactly which line of code you're having a problem with. Maybe someone else will.

    I do wish you the best of luck with it though.

    Regards,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width