Commit 07d20ba1 authored by francescomani's avatar francescomani

fix for memory issues

parent fb118a76
......@@ -155,23 +155,6 @@ void phy_term_nr_ue__PDSCH(NR_UE_PDSCH* pdsch, const NR_DL_FRAME_PARMS *const fp
free_and_zero(pdsch->dl_ch_ptrs_estimates_ext);
}
void phy_init_nr_ue_PUSCH(NR_UE_PUSCH *const pusch,
const NR_DL_FRAME_PARMS *const fp) {
AssertFatal( pusch, "pusch==0" );
int max_encoded_length = fp->N_RB_UL*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8*NR_MAX_NB_LAYERS;
for (int i=0; i<NR_MAX_NB_LAYERS; i++) {
pusch->txdataF_precoding[i] = (int32_t *)malloc16_clear((max_encoded_length)*sizeof(int32_t *));
}
}
void phy_term_nr_ue_PUSCH(NR_UE_PUSCH *pusch)
{
for (int i = 0; i < NR_MAX_NB_LAYERS; i++)
free_and_zero(pusch->txdataF_precoding[i]);
}
int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
{
// create shortcuts
......
......@@ -110,9 +110,9 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL)
ulsch->harq_processes[i] = (NR_UL_gNB_HARQ_t *)malloc16_clear(sizeof(NR_UL_gNB_HARQ_t));
ulsch->harq_processes[i]->b = (uint8_t*)malloc16_clear(ulsch_bytes);
ulsch->harq_processes[i]->c = (uint8_t**)malloc16_clear(a_segments);
ulsch->harq_processes[i]->d = (int16_t**)malloc16_clear(a_segments);
ulsch->harq_processes[i]->p_nrLDPC_procBuf = (t_nrLDPC_procBuf **)malloc16_clear(a_segments);
ulsch->harq_processes[i]->c = (uint8_t**)malloc16_clear(a_segments*sizeof(uint8_t *));
ulsch->harq_processes[i]->d = (int16_t**)malloc16_clear(a_segments*sizeof(int16_t *));
ulsch->harq_processes[i]->p_nrLDPC_procBuf = (t_nrLDPC_procBuf **)malloc16_clear(a_segments*sizeof(t_nrLDPC_procBuf *));
for (r=0; r<a_segments; r++) {
ulsch->harq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem();
ulsch->harq_processes[i]->c[r] = (uint8_t*)malloc16_clear(8448*sizeof(uint8_t));
......
......@@ -149,8 +149,8 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, int number_of_harq_pids, NR_DL_
DevAssert(ulsch->harq_processes[i]->b);
bzero(ulsch->harq_processes[i]->b,ulsch_bytes);
ulsch->harq_processes[i]->c = malloc16(a_segments);
ulsch->harq_processes[i]->d = malloc16(a_segments);
ulsch->harq_processes[i]->c = malloc16(a_segments*sizeof(uint8_t *));
ulsch->harq_processes[i]->d = malloc16(a_segments*sizeof(uint16_t *));
for (int r = 0; r < a_segments; r++) {
// account for filler in first segment and CRCs for multiple segment case
ulsch->harq_processes[i]->c[r] = malloc16(8448);
......
......@@ -122,8 +122,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
int sample_offsetF, N_RE_prime;
NR_DL_FRAME_PARMS *frame_parms = &UE->frame_parms;
NR_UE_PUSCH *pusch_ue = UE->pusch_vars[thread_id][gNB_id];
int16_t **tx_precoding = (int16_t **)pusch_ue->txdataF_precoding;
int32_t **txdataF = UE->common_vars.txdataF;
int N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig
......@@ -333,13 +331,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
#endif
}
else
memcpy(y, tx_layers[0], (available_bits/mod_order)*sizeof(int32_t));
for (int nl = 0; nl < Nl; nl++)
free_and_zero(tx_layers[nl]);
free_and_zero(tx_layers);
///////////
////////////////////////////////////////////////////////////////////////
......@@ -348,6 +340,10 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
/////////////////////////ULSCH RE mapping/////////////////////////
///////////
int encoded_length = frame_parms->N_RB_UL*number_of_symbols*NR_NB_SC_PER_RB*mod_order*Nl;
int16_t **tx_precoding = (int16_t **)malloc16_clear(Nl*sizeof(int16_t *));
for (int nl=0; nl<Nl; nl++)
tx_precoding[nl] = (int16_t *)malloc16_clear((encoded_length<<1)*sizeof(int16_t));
for (int nl=0; nl < Nl; nl++) {
uint8_t k_prime = 0;
......@@ -554,6 +550,13 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
harq_process_ulsch = UE->ulsch[thread_id][gNB_id]->harq_processes[harq_pid];
harq_process_ulsch->status = SCH_IDLE;
for (int nl = 0; nl < Nl; nl++) {
free_and_zero(tx_layers[nl]);
free_and_zero(tx_precoding[nl]);
}
free_and_zero(tx_layers);
free_and_zero(tx_precoding);
///////////
////////////////////////////////////////////////////////////////////////
......
......@@ -225,11 +225,6 @@ typedef struct {
} NR_UE_COMMON_PER_THREAD;
typedef struct {
/// TX buffers for UE-spec transmission
int32_t *txdataF_precoding[NR_MAX_NB_LAYERS];
} NR_UE_PUSCH;
typedef struct {
bool active[2];
fapi_nr_ul_config_pucch_pdu pucch_pdu[2];
......@@ -793,9 +788,6 @@ typedef struct {
NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_gNB_MAX];
NR_UE_DLSCH_t *dlsch_MCH[NUMBER_OF_CONNECTED_gNB_MAX];
// to be removed again possibly
NR_UE_PUSCH *pusch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX];
//Paging parameters
uint32_t IMSImod1024;
uint32_t PF;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment