Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSEngine setMemoryAllocationCallback bug #129

Open
GoogleCodeExporter opened this issue Dec 2, 2015 · 1 comment
Open

JSEngine setMemoryAllocationCallback bug #129

GoogleCodeExporter opened this issue Dec 2, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link


I identified what seems to be a bug in JSEngine setMemoryAllocationCallback 
method. In order to reproduce it I used the attached snippet (which is quite 
similar to one of the tests included in the tree). Executing the code does not 
return the expected results.

buffer@alnitak ~ $ python MemAlloc.py 
{}

Moreover the test included in PyV8.py is not really complete

2087     def testMemoryAllocationCallback(self):
2088         alloc = {}
2089 
2090         def callback(space, action, size):
2091             alloc[(space, action)] = alloc.setdefault((space, action), 0) 
+ size
2092 
2093         JSEngine.setMemoryAllocationCallback(callback)
2094 
2095         with JSContext() as ctxt:
2096             self.assertEquals({}, alloc)
2097 
2098             ctxt.eval("var o = new Array(1000);")
2099 
2100             alloc.has_key((JSObjectSpace.Code, JSAllocationAction.alloc))
2101 
2102         JSEngine.setMemoryAllocationCallback(None)

As you can see it does not check if the alloc dict is updated as result of the 
callback invocation.

Am I missing something or it's really a bug?


Additional details

buffer@alnitak ~/pyv8 $ svn info
Path: .
URL: http://pyv8.googlecode.com/svn/trunk
Repository Root: http://pyv8.googlecode.com/svn
Repository UUID: 3b770cb8-f9e6-11dd-ac5b-dfceb64ead24
Revision: 445
Node Kind: directory
Schedule: normal
Last Changed Author: [email protected]
Last Changed Rev: 443
Last Changed Date: 2012-06-21 15:38:06 +0200 (Thu, 21 Jun 2012)

buffer@alnitak ~/v8 $ svn info
Path: .
URL: http://v8.googlecode.com/svn/trunk
Repository Root: http://v8.googlecode.com/svn
Repository UUID: ce2b1a6d-e550-0410-aec6-3dcde31c8c00
Revision: 12249
Node Kind: directory
Schedule: normal
Last Changed Author: [email protected]
Last Changed Rev: 12243
Last Changed Date: 2012-08-01 13:14:42 +0200 (Wed, 01 Aug 2012)




Original issue reported on code.google.com by [email protected] on 1 Aug 2012 at 3:14

Attachments:

@GoogleCodeExporter
Copy link
Author

Original comment by [email protected] on 1 Aug 2012 at 4:16

  • Changed state: Accepted
  • Added labels: OpSys-All

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant