Using the Free Command on Node Construction: Potential Risks and Solutions

  • Thread starter Thread starter transgalactic
  • Start date Start date
AI Thread Summary
In C programming, it is essential to use the free() command for any memory allocated with malloc() or calloc() when it is no longer needed. Failing to do so will result in memory leaks, which can fill up system memory and potentially harm performance. This applies to memory allocated by C-Library functions like strdup as well. In C++, memory allocated for class objects should be released using the delete command. Proper memory management is crucial to maintain system stability and efficiency.
transgalactic
Messages
1,386
Reaction score
0
do i have to use free command on each node i have constructed

will it damage my computer if i will leave it as it i now
(fill out my memory)
Reply With Quote
 
Technology news on Phys.org
I suppose you are writing code in C.
Any memory that you have assigned using malloc(), calloc() should be freed using the free() command when you no longer need it.
This includes memory that has been allocated by functions of the C-Library, such as strdup.
Yes, failing to free memory properly will cause a memory leak, i.e. fill up your memory unnecessarily.
If you want to do some reading on the subject, try:
http://www.yolinux.com/TUTORIALS/C++MemoryCorruptionAndMemoryLeaks.html
Also, if you are writing in C++, memory that you have assigned as objects of classes must be freed using the delete command.
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
Thread 'Project Documentation'
Trying to package up a small bank account manager project that I have been tempering on for a while. One that is certainly worth something to me. Although I have created methods to whip up quick documents with all fields and properties. I would like something better to reference in order to express the mechanical functions. It is unclear to me about any standardized format for code documentation that exists. I have tried object orientated diagrams with shapes to try and express the...
Back
Top