acmpesuecc / SmartGC

A smart garbage collector for C
MIT License
0 stars 8 forks source link

variable allocated in lower scope and passed to higher scope #6

Closed tejas-techstack closed 1 week ago

tejas-techstack commented 1 week ago

If a variable is allocated in a lower scope and is returned to a higher scope, then the memory will need to be freed in the higher scope. eg:

int * myFunc(){
  int *x = malloc(sizeof(int));
  *x = 15;
  return x;
}

int main(){
  int *valOfx = myFunc();
  printf("%d\n", x);
  // Free is to be injected here and valOfx is to be freed.
  return 0;
}

this requires keeping track of the variable through the scopes. your job is to make sure that the memory is freed correctly in the higher scope

bunsamosa-bot[bot] commented 1 week ago

Thank you for opening this issue! A Maintainer will review it soon!

H-Mudliar commented 1 week ago

can you please assign this to me

tejas-techstack commented 1 week ago

alright im assigning you @H-Mudliar i will be giving you 1 hr 30 min as of now, based on your progress we shall extend the time if needed

tejas-techstack commented 1 week ago

!assign @H-Mudliar 90

tejas-techstack commented 1 week ago

when you are done and want to create a pullrequest please send me a message so that i can confirm which branch you will need to create the pull request to @H-Mudliar

H-Mudliar commented 1 week ago

alright im assigning you @H-Mudliar i will be giving you 1 hr 30 min as of now, based on your progress we shall extend the time if needed

Im going for dinner now can you please extend time

tejas-techstack commented 1 week ago

!extend 60

bunsamosa-bot[bot] commented 1 week ago

Extended timer by 30

tejas-techstack commented 1 week ago

i hope you are working on this

bunsamosa-bot[bot] commented 1 week ago

Hey @tejas-techstack! The timer for the @H-Mudliar to work on the issue has finished, deassign and assign a new contributor or extend the current timer. Contact maintainer leads if inactive @DedLad @polarhive @achyuthcodes30

tejas-techstack commented 1 week ago

!deassign

tejas-techstack commented 1 week ago

!assign @H-Mudliar

bunsamosa-bot[bot] commented 1 week ago

Hey @tejas-techstack! The timer for the @H-Mudliar to work on the issue has finished, deassign and assign a new contributor or extend the current timer. Contact maintainer leads if inactive @DedLad @polarhive @achyuthcodes30

tejas-techstack commented 1 week ago

@H-Mudliar Do you have any progress?

tejas-techstack commented 1 week ago

@H-Mudliar i am deassigning you so that others can work on this if they want

tejas-techstack commented 1 week ago

!deassign

Nightwing000 commented 1 week ago

can i be assigned

tejas-techstack commented 1 week ago

!assign @Nightwing000 90

tejas-techstack commented 1 week ago

you have 1 and a half hour, if you are not able to finish within that time but have progress i will see and extend the time

Nightwing000 commented 1 week ago

Thanks

Nightwing000 commented 1 week ago

Hi so do you need it to free properly only in main or for any function of higher scope?

Nightwing000 commented 1 week ago

also if just main is acceptable please tell how many points

Nightwing000 commented 1 week ago

@tejas-techstack can you please tell so I can start implementing

tejas-techstack commented 1 week ago

hey im so sorry i was working on something else

tejas-techstack commented 1 week ago

yea so i will be able to give you only 200 points if you can successfully implement it for main alone the max bounty is extremely hard because of multiple different higher scopes.

Nightwing000 commented 1 week ago

ah no problem thank you so much

tejas-techstack commented 1 week ago

are you going to be working on it?

Nightwing000 commented 1 week ago

yeah lemme see if I can implement the entire thing(not just main)

bunsamosa-bot[bot] commented 1 week ago

Hey @tejas-techstack! The timer for the @Nightwing000 to work on the issue has finished, deassign and assign a new contributor or extend the current timer. Contact maintainer leads if inactive @DedLad @polarhive @achyuthcodes30

tejas-techstack commented 1 week ago

!deassign

tejas-techstack commented 1 week ago

!assign @Nightwing000

Nightwing000 commented 1 week ago

I've made progress I think I'll be done after the performances(taking a break)

bunsamosa-bot[bot] commented 1 week ago

Hey @tejas-techstack! The timer for the @Nightwing000 to work on the issue has finished, deassign and assign a new contributor or extend the current timer. Contact maintainer leads if inactive @DedLad @polarhive @achyuthcodes30

tejas-techstack commented 1 week ago

!assign @Nightwing000

tejas-techstack commented 1 week ago

@Nightwing000 were you able to run the program on windows, without libclang-dev?

Nightwing000 commented 1 week ago

I downloaded llvm and it worked but I'm having issues with the check_alloc_term function my logic goes like finding only variables that contain main but yea it doesn't give the output still trying

Nightwing000 commented 1 week ago

please let me know if you can see my pull request @tejas-techstack

tejas-techstack commented 1 week ago

hey sorry i was a bit busy

tejas-techstack commented 1 week ago

!deassign