Jump to content
Lorenos

SystemC 2.3.3: huge memory consumption when using sc_spawn - sc_bind

Recommended Posts

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×