[PD] RAM usage (Pd-0.38.4-extended-RC7 & cyclone)

Martin Peach martinrp at vax2.concordia.ca
Tue Jan 24 21:41:18 CET 2006


Mathieu Bouchard wrote:

>
>I wanted to know what's the amount of RAM used up by a .dll file
>once loaded in RAM. I ask because I know that in Linux, the amount of RAM
>taken by a .so file once loaded in RAM is more than the length of the file
>due both to paging issues and to "fixup" issues (basically the table used
>for dlsym() which is used for relocating pointers considering that RAM
>positions can't be hardcoded in a .so)
>  
>
 From a test I just did on WinXP:
ctrl-alt-delete, select  processes, launch pd:
 
startup pd 0.39 test 7 with several libs: 8,940K
create new patcher: 8,948K -> +8K
put object: 8,960K -> +12K
name it helloworld: 9,180K -> +220K (this helloworld.dll is 6K on disk)
put object: 9,180K
name it helloworld: 9,180K
put bang: 9,184K -> + 4K
connect it to a helloworld: 9,184K
put bang: 9,184K
connect it to a helloworld: 9,184K
remove everything and then close the patcher: 9,184K

It looks like the smallest blocks allocated are 4K. I wonder why 
helloworld takes 220k. It was linked against pd.lib and kernel32.lib. My 
pd.lib is 85K on disk, kernel32.lib is 190K.

Second test:
startup pd 0.39 test 7 with several libs: 8,916K (This time pd starts 
with less memory)
create new patcher: 8,924K -> +8K
put object: 8,936K -> +12K
name it expr $1 + 1: 9,140K -> +204K (expr.dll is 152K on disk)
put object: 9,140K
name it expr $1 + 1: 9,140K
remove everything and then close the patcher: 9,140K


Martin

============================================================================================
This is the code of helloworld:
#define MSW
#include "m_pd.h"

static t_class *helloworld_class;

typedef struct helloworld
{
    t_object    x_obj;
} t_helloworld;


void helloworld_bang(t_helloworld *x);
__declspec(dllexport) void helloworld_setup(void);
void *helloworld_new(void);

void helloworld_bang(t_helloworld *x)
{
    post("Hello World :0");
}

__declspec(dllexport) void helloworld_setup(void)
{
    helloworld_class = class_new(gensym("helloworld"),
        (t_newmethod)helloworld_new,
        0, sizeof(t_helloworld),
        CLASS_DEFAULT, 0);
    class_addbang(helloworld_class, helloworld_bang);
}

void *helloworld_new(void)
{
    t_helloworld *x = (t_helloworld *)pd_new(helloworld_class);
    return (void *)x;
}






More information about the Pd-list mailing list