Arhhh! Memory leaks again?!! How many times I have been working on this shit? It has been reviewed and rework for many, many times. Remember, there are once a major changes to the code, most probably I miss out to run the unit test on Windows then now all test cases were failed in clearMemory(). For now I am reworking on the logic for clearing the memory, I hope this is the last and final.
Sunday, September 23, 2018
Friday, September 21, 2018
How Boost Property Tree works in object loop?
I am in the midst of working on the extraction of file listing captured in memory into a text file. The task was simple, I will just write each file path into a line and then follow by another path in the next line. But I felt this method does not look good, I was thinking about future expansion, there would be a possibility of rework. And I hate rework. And thus, I change my direction to keep them in XML, which I felt much more organize. Besides storing the file listing, I'll also store the date captured on this listing, the destination path and the source path.
For this purpose, I'm using Boost Property Tree. According to the tutorial on Boost Property Tree, the code was very easy to handle. For that, I separate the piece away from the core object and put them into a brand new object, where the object will take the sole responsibility in handling the reading and writing of XML content. And for the sake of the whole execution, the object will have only one instance in the memory. And then I give a name for this object called Configuration.
Brilliant! When I test out the code, the content was successfully transferred into the designate file as shown in the following.
Unfortunately, in another test case, I am not able to read it back from the file, there are funny characters shown in the output on line 9 in the following code. There is no problem with the file being generated. I have no clue how this could happen. I am totally blind now.
Many hours were spent to debug this shit, and I found the root cause at last. It was really shocking on my finding. I just rework at line 8 in the above code and make it like the code shown below at line 10 and 12.
From this experience, I wonder how this Boost Property Tree is actually works in object loop?
For this purpose, I'm using Boost Property Tree. According to the tutorial on Boost Property Tree, the code was very easy to handle. For that, I separate the piece away from the core object and put them into a brand new object, where the object will take the sole responsibility in handling the reading and writing of XML content. And for the sake of the whole execution, the object will have only one instance in the memory. And then I give a name for this object called Configuration.
Brilliant! When I test out the code, the content was successfully transferred into the designate file as shown in the following.
Unfortunately, in another test case, I am not able to read it back from the file, there are funny characters shown in the output on line 9 in the following code. There is no problem with the file being generated. I have no clue how this could happen. I am totally blind now.
Many hours were spent to debug this shit, and I found the root cause at last. It was really shocking on my finding. I just rework at line 8 in the above code and make it like the code shown below at line 10 and 12.
From this experience, I wonder how this Boost Property Tree is actually works in object loop?
Subscribe to:
Posts (Atom)