I've got a suggestion as to the problem with memory leaking/allocation such as
in Bugs #1463115 and #1495645. If you are familiar with exceptions like in Java, integrating XXL
(http://www.zork.org/xxl/) into libcprops might be useful. This greatly eases cleanup in
case of errors, it's harder to forget something...
Just have a look at it's Documentation.
Hope this can be of help to you.
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I do see the merit of having exceptions, but I'm not convinced about switching to XXL:
* would this impact performance? It looks like the error handling which would otherwise be hard coded is calculated at runtime instead. Also the asset management feature means a linked list is constructed for allocated assets which must be deallocated whether an error occurs or not.
* this would make cprops dependent on another package.
* this would require a major rewrite.
The way I see it at the moment, I'd rather just fix the code where the allocations aren't checked properly.
- Ilan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think the performance impact is negligible. The macros used will for example do direct jumps to the Exception Handling code. Also you would use it only at certain points in the code, the performance in other parts will not be influenced.
Of course your other points are valid...
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, the performance impacts for jumps would probably be negligible. But XXL also does what they call 'asset management', which means memory allocations are put on a list in case they need to be rolled back, when an exception occurs. The asset list is created and destroyed whether an exception occurs or not. Also, this list is allocated on the heap, which means another 2 system calls for every allocation. Admittedly all of this may not add up to much on the average case, but code that does a lot of insertions and removals to a hashtable for instance might show some slow down.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've got a suggestion as to the problem with memory leaking/allocation such as
in Bugs #1463115 and #1495645. If you are familiar with exceptions like in Java, integrating XXL
(http://www.zork.org/xxl/) into libcprops might be useful. This greatly eases cleanup in
case of errors, it's harder to forget something...
Just have a look at it's Documentation.
Hope this can be of help to you.
Martin
Hi Martin,
I do see the merit of having exceptions, but I'm not convinced about switching to XXL:
* would this impact performance? It looks like the error handling which would otherwise be hard coded is calculated at runtime instead. Also the asset management feature means a linked list is constructed for allocated assets which must be deallocated whether an error occurs or not.
* this would make cprops dependent on another package.
* this would require a major rewrite.
The way I see it at the moment, I'd rather just fix the code where the allocations aren't checked properly.
- Ilan
I think the performance impact is negligible. The macros used will for example do direct jumps to the Exception Handling code. Also you would use it only at certain points in the code, the performance in other parts will not be influenced.
Of course your other points are valid...
Martin
Yes, the performance impacts for jumps would probably be negligible. But XXL also does what they call 'asset management', which means memory allocations are put on a list in case they need to be rolled back, when an exception occurs. The asset list is created and destroyed whether an exception occurs or not. Also, this list is allocated on the heap, which means another 2 system calls for every allocation. Admittedly all of this may not add up to much on the average case, but code that does a lot of insertions and removals to a hashtable for instance might show some slow down.