On Aug 2, 2012, at 4:30 AM, David Lutterkort <[email protected]> wrote:

I was sceptical too, but it does fix the problem with increasing
memory. Jan script (JIRA) made memory on my VM grow every second
and the request time increased into ~1.5sec.

It seems to me that 'require_relative' always loads the file OR
the driver_class variable. Also just FYI, this does not happen
on my OSX or on Ubuntu for some reason…

  -- Michal


> On Wed, 2012-08-01 at 13:40 +0200, [email protected] wrote:
>> From: Michal Fojtik <[email protected]>
>> 
>> This patch should prevent memory leaking caused
>> by repetetive driver loading on every request.
>> 
>> Signed-off-by: Michal fojtik <[email protected]>
>> ---
>> server/lib/deltacloud/helpers/driver_helper.rb |    4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/server/lib/deltacloud/helpers/driver_helper.rb 
>> b/server/lib/deltacloud/helpers/driver_helper.rb
>> index 5c5e7c6..ab0e3c6 100644
>> --- a/server/lib/deltacloud/helpers/driver_helper.rb
>> +++ b/server/lib/deltacloud/helpers/driver_helper.rb
>> @@ -42,14 +42,14 @@ module Deltacloud::Helpers
>>         m = Deltacloud::Drivers.const_get(driver_class_name)
>>         m.const_get(driver_class_name + "Driver").new
>>       rescue NameError
>> -        raise "[ERROR] The driver class name is not defined as 
>> #{driver_class_name}Driver"
>> +        nil
>>       end
>>     end
>> 
>>     def driver
>>       $:.unshift File.join(File.dirname(__FILE__), '..', '..')
> 
> This here extends $: every time we load a driver. Shouldn't lib/ be on
> $: already anyway ?
> 
>>       begin
>> -        require_relative driver_source_name
>> +        require_relative(driver_source_name) unless driver_class
> 
> I don't see how this can leak .. require only loads of the file hasn't
> been loaded already.
> 
> David
> 
> 

Reply via email to