Deleting and Detaching Shaders

Alright, so I stumbled upon something I thought was interesting, why do we detach and delete shaders? According to a couple forum posts you should do this to save memory, apparently quite a bit of memory. However, there are other posts suggesting that we should not be doing this. Which would be correct and why?

Here are the threads in question:

http://www.java-gaming.org/topics/having-trouble-with-drawing-a-triangle/31691/view.html


https://gamedev.stackexchange.com/questions/47910/after-a-succesful-gllinkprogram-should-i-delete-detach-my-shaders


https://stackoverflow.com/questions/9113154/proper-way-to-delete-glsl-shader

As most of your links suggest: Detaching and deleting shaders after the shader program has been linked is the correct way to go. :point:
This way you’ll free up quite substantial memory in the VRAM: (Quote from your stackoverflow link)

[quote]…
That way the driver can free up all the memory it is using to hold a copy of the shader source and unlinked object code, which can be quite substantial. Measurements I have done indicate that NOT deleting the shader objects increases the incremental memory use per shader by 5-10x
[/quote]
The only reason why you might don’t want to do this is because there are some buggy drivers out there which might not like this practice (even though this should be the standard way of dealing with shaders), but then again I would never implement hacky solutions or try to fit my code just so it runs on bad drivers too. AAA companies might have to do that, but we lone wolves have enough things already to put up with. :smiley:

OK so I guess I just have to watch out for them bugs. Thanks.