Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
npyl committed Jan 10, 2018
1 parent 367a19d commit 61fc4d1
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/darwin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -517,16 +517,6 @@ int update_running_processes(void)
*/
void get_cpu_count(void)
{
/* XXX MEMORY LEAK
*
* In FreeBSD, Linux (and probably other, too) implementations exists the following bug (memory leak)
*
* info.cpu_count is allocated every time get_cpu_count() is called without checking if it was allocated again before...
* thus conky allocates only memory related to one get_cpu_count() call leaving a memory leak.
*
* Fixed by adding check to see if memory has been allocated or not.
*/

int cpu_count = 0;

if (GETSYSCTL("hw.activecpu", cpu_count) == 0) {
Expand All @@ -538,7 +528,7 @@ void get_cpu_count(void)

/* XXX
* Probably move the info.cpu_usage allocation inside the update_cpu_usage() function...
* Why is it here anyway?
* Why is it here ??
*
* Unless i find some reason for keeping it here it will be moved to update_cpu_usage()
*
Expand Down Expand Up @@ -569,11 +559,9 @@ void get_cpu_count(void)

/*
* used by update_cpu_usage()
*
* XXX will be merged into cpusample probably
*/
struct cpu_info {
/* freebsd compatibility */
struct cpu_info
{
long oldtotal;
long oldused;
};
Expand Down

0 comments on commit 61fc4d1

Please sign in to comment.