| Thread overview | |||||
|---|---|---|---|---|---|
|
March 08, 2014 Allocating memory from library | ||||
|---|---|---|---|---|
| ||||
Hi !
I just wondered if this code is valid:
void main() {
auto p = my_allocate();
// ...
my_free(p);
}
extern(System):
void *my_allocate();
void my_free(void *);
Where my_allocate and my_free are in the external dll. Main question is: is this code transparent to GC? Will not it try to collect memory which is pointed by p after my_free?
Thanks!
| ||||
March 08, 2014 Re: Allocating memory from library | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Temtaime | The GC will only scan through and try to ECG memory that it owns. So that's safe. | |||
March 08, 2014 Re: Allocating memory from library | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | Thanks ! | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply