English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 22 May 2014, 01:40   #1
mritter0
Registered User
 
Join Date: Sep 2013
Location: Bettendorf, IA, USA
Age: 52
Posts: 204
Eat memory

This is a new one to me.

I start my program, from Shell or Workbench, all is good.

I start another copy. As soon as the window is opened it eats 1.5MB of RAM for no reason.

I close either copy, it is released.

If I open multiple copies, each one uses 1.5MB again. When I close one, it releases the 1.5MB. When get down to the last window, of any copy, it is back to the "normal" 140KB used RAM.

Only the second and higher copy causes the memory usage. First copy is fine.

I have been using this code since "back in the day"
Code:
BOOL
SAK_SegmentSplit(STRPTR CommandName,STRPTR Name,BYTE Pri,LONG StackSize,APTR Function)
{
    struct Process                  *Child, *Me;
    struct CommandLineInterface     *CLI;

    Me=(struct Process *)FindTask(NULL);

    if (Me->pr_CLI)
    {
        CLI=(struct CommandLineInterface *)BADDR(Me->pr_CLI);

        Forbid();

        if (Child=CreateNewProcTags(
            NP_CommandName,     CommandName,
            NP_Name,            Name,
            NP_Priority,        Pri,
            NP_StackSize,       StackSize,
            NP_Entry,           Function,
            NP_Cli,             TRUE,
            NP_ExitCode,        (VOID (*)())SAK_ProcessCleanup,
            NP_ExitData,        CLI->cli_Module,
        TAG_DONE))
            CLI->cli_Module=NULL;
        else
        {
            Permit();

            Printf("\x1B[1m%s:\x1B[0m Failed to create new process!\a\n",CommandName);

            return(FALSE);
        }

        Permit();
    }

    return(TRUE);
}
Anything in there the culprit? I am at a loss.
mritter0 is offline  
Old 22 May 2014, 14:38   #2
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
Attached code looks fine (EDIT: but also too much code is not included), clearing cli_Module is quite common method to prevent executable memory deallocation when it exits.

Last edited by Toni Wilen; 22 May 2014 at 17:00.
Toni Wilen is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
[FOUND] We Eat Lamers for Breakfast Leffmann request.Demos 3 30 January 2012 12:21
Eat a Log, best Amiga game ever... s2325 Retrogaming General Discussion 4 11 April 2011 10:02
listing my drawer games eat my chipmem ! Foul support.Other 19 09 April 2010 19:29
Eat the Whistle ECS/OCS ? lolafg request.Old Rare Games 11 11 June 2009 08:18
Eat the Whistle GPL Nyarlathotep Amiga scene 1 19 September 2003 22:50

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


All times are GMT +2. The time now is 17:22.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.14768 seconds with 15 queries