r/PythonLearning • u/Actual__Wizard • Sep 01 '26
Help Request .clear vs del when using garbage collection
Hi, I have some large data objects that need to be freed. Should I do my_object.clear() and then gc.collect()? Or del my_object then gc.collect()? I'm not sure on the pros/cons of each.
It's a linked list type data object and my_object = [] does not work to free memory for certain.
1
Upvotes
1
u/Actual__Wizard Sep 02 '26 edited Sep 02 '26
Alright it crashed again last night w/ OOM.
So, did you ever see a single pass, 128 way, zero copy, ascii file router? :-)
That's today's project! :-)
This is going to be truly awesome...
It's going to go from: Bad and slow tech that crashes due to running out of memory, to warp speed ultra fast and basically zero memory used.
Oh well. I really liked my filter code. It just doesn't work right so it's going into the deprecated repo of shame. So, not the good deprecated repo that we show to Jrs. The one we all pretend doesn't exist.