Jump to content

SystemC 2.3.3: huge memory consumption when using sc_spawn - sc_bind


Recommended Posts

Posted

Hello,

I've noticed that with SystemC 2.3.3, when I spawn a dynamic process, there is a huge memory consumption.

Here' s the code generating the problem

#include "test_module.h"

void test_module::my_process(int temp) {
    printf("thread spwned @ %.1f\n",sc_simulation_time());
    wait(1000,SC_NS);
}

void test_module::test_thread(void) {
    int temp=0;
    while(true) {
        printf("current time is %.1f\n",sc_simulation_time());
        if (sc_simulation_time()>=100000000) {
            printf("stop here\n");
            wait();
            sc_stop();
        }
        else {
            sc_spawn_options my_thread;
            sc_process_handle test_proc;
            my_thread.set_sensitivity(&clock.pos());
            test_proc = sc_spawn(sc_bind(&test_module::my_process,this,temp),NULL,&my_thread);
            wait(10,SC_NS);
        }
    }
}

Basically, when I run the program I see the memory associated to the process steadily growing up second after second.

SystemC has been configured with the following switches:

--enable-shared=no

--disable-async-updates

and compiled as static library.

The host OS is ubuntu 16.04 and G++ version is 5.4.0 20160609

The same code compiled on an ubuntu 10.04 with SystemC 2.2.0 does not show any memory problem.

 

Any idea on why this happens?

Thanks

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...